**************************************************************************************************************
*	VARCHAR2最多存放4000字节的数据，最多可以可以存入4000个字母，或最多存入2000个汉字
*	（数据库字符集编码是GBK时，varchar2最多能存放2000个汉字，数据库字符集编码是UTF-8时，那就最多只能存放1333个汉字）
*
*	NVARCHAR2（size），size最大值为2000，单位是字符，而且不管是汉字还是字母，每个字符的长度都是2个字节。
*	所以nvarchar2类型的数据最多能存放2000个汉字，也最多只能存放2000个字母。并且NVARCHAR2不受数据库字符集的影响。
**************************************************************************************************************
设计字段长度时按照字符集编码为：UTF-8
每个表要有一个row_id字段作为主键，存储唯一索引，使用uuid

表和字段命名规则：
	使用英文命名，用下划线间隔英文单词

为避免过多关联，操作员和操作员姓名同时添加到表里
字段多值单选的comment格式：【数据库类型:oracle/mysql】

字段类型统一：
	整型				number
	日期				date
	数值				number(22,5)
	字符串			varchar2
	带中文的字符串	nvarchar2

常见字段：
	row_id			varchar2(32)			uuid主键
	add_id			varchar2(20)			记录人
	add_name		nvarchar2(20)			记录人姓名
	add_date		date default sysdate	记录时间
	edit_id 		varchar2(20)			编辑人
	edit_name		nvarchar2(20)			编辑人姓名
	edit_date		date					编辑时间
	owner_id       	varchar2(30)			货主
	vendor_id		varchar2(30)			供应商
	customer_id		varchar2(30)			客户
	carrier_id		varchar2(30)			承运商
	sku				varchar2(60)			货品
	descr			nvarchar2(60)			描述
	lot             varchar2(20)			批次
	rdc_id			varchar2(30)			物流中心
	warehouse_id	varchar2(30)			仓库
	region_id		varchar2(30)			区域(收货/存储/发货/集货)
	area_id			varchar2(30)			库区
	lane_id			varchar2(30)			巷道
	loc_id			varchar2(30)			库位
	qty  			number(22,5)			数量
	qty_picked		number(22,5)			拣货数量
	qty_checked		number(22,5)			复核数量
	qty_loaded		number(22,5)			装载数量
	order_id		varchar2(30)			订单号
	line_id			varchar2(30)			行项
	container		varchar2(30)			容器
	status			varchar2(10)			状态
	active			varchar2(1)				有效
	notes			nvarchar2(60)			备注
	udf1			varchar2(50)			用户自定义1
	xxx_type        nvarchar2(30)           某类型

数据库信息：
	IP:115.29.142.248
	port:21521
	sid:xe
使用system用户：
--drop user base_auth cascade;
create user base_auth identified by base_auth;
grant CREATE USER,DROP USER,ALTER USER,CREATE ANY VIEW,
      DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,
      DBA,CONNECT,RESOURCE,CREATE SESSION TO base_auth;

--drop user master_business cascade;
create user master_business identified by master_business;
grant CREATE USER,DROP USER,ALTER USER,CREATE ANY VIEW,
      DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,
      DBA,CONNECT,RESOURCE,CREATE SESSION TO master_business;

微服务架构：
1.基础数据类						wms-common
2.权限数据接口					wms-authority-api
3.主业务接口						wms-business-api
-----------------------------------------------------
1.权限数据服务 					wms-authority
2.主业务服务 					wms-business
3.前端(PC/手持)入口聚合服务 		wms-entry
4.接口服务 						wms-edi
5.定时任务 						wms-task

缺表：
	唯一码采集表
主要表:
*物流中心			rdc
*版本信息			sys_version
*基础数据表头			dictionary
*基础数据明细			dictionary_list
*城市编码 			city
*部门组织 			department
*物流中心与货主对应	rdc_storer
*系统用户 			users
*功能模块			resources
*角色				role
*物流中心用户			rdc_user
*物流中心角色			rdc_role
*角色对应的功能		role_resource
*角色下的用户			role_user
系统配置表			wms_config
货主					owner
供应商				vendor
客户					customer
承运商				carrier
货品					sku
商品品牌        		sku_brand
商品价格        		sku_price
货品分类				sku_sort
货品条码				alias_sku
门店柜组             mid_store
送货区域             mid_ deliver_area
支付方式             mid_pay_type
渠道信息             mid_channel
客户\部门\仓库\渠道   cust_o_w_channel
包装					pack
仓库					warehouse
月台					dock
区域					region
库区					area
巷道					lane
库位组 				loc_group
库位					loc
库位与自动库对应    	wms_loc_wcs 
入库单据类型			inbound_type
出库单据类型			outbound_type
分拣口				sorter
容器					container
设备      			equipment
集货区客户  			shipping_area_customer(CLIENTSAREA)
单号生成规则			ncount
配送路线				delivery_route
配送路序				delivery_route_stop
打印机主档			printer
打印模板				reports_mould
质检等级      		qc_grade
采购单				po
采购单明细			po_detail
收货验证规则			receipt_validation
收货单				receipt
收货单明细			receipt_detail
收货分组      		receipt_group
收货明细      		receipt_lpn
--越库单 			crossdock
--越库单明细			crossdock_detail
入库单 				inbound
入库单明细			inbound_detail
波次					wave
波次明细				wave_detail
波次分配开关  		wave_alloc_switch
出库订单				orders
出库订单明细			orders_detail
标签主档  			lpn_document(GATHERBOOK_TASK)
任务明细				task_detail
合并任务明细			task_consolidation_detail
拣货明细				pick_detail
--复核明细			check_detail
装载明细				load_detail
派车信息      		transport
派车装载客户  		transport_detail
合箱日志 			merge_log
出库单 				outbound
出库单明细			outbound_detail
短拣策略				short_strategy
单据状态更变日志		status_log
库存调整单			adjustment
库存调整明细			adjustment_detail
移动单				move
移动单明细			move_detail
补货任务				replenishment
库存交易日志			inventory_log
盘点模板				physical_mould
库存盘点				physical
批属性验证 			lot_validation
批属性				lotattribute
库存表				inventory
库存唯一码			inventory_sn
唯一码操作日志 		sn_log
上架策略				putaway_strategy
上架策略明细			putaway_strategy_detail
分配策略				allocate_strategy
分配策略明细			allocate_strategy_detail
订单顺序策略 			orders_sequence
库存周转规则			inventory_rotation
库存冻结编码			inventory_hold_code
库存冻结 			inventory_hold
数据修改日志			data_modify_log
操作日志 			operation_log


wcs接口表(三个库的一样)    FACILITY_INTERFACE

输送线接口任务下发表      CONVEYOR_INTERFACE

输送线接口设备回传表      CONVEYOR_BACK

--------------------------------------------
------------------------------------SQL Part
--------------------------------------------
```
create table FACILITY_INTERFACE
(
    ID            NUMBER,
    REGION        varchar2(5),
    WMS_TYPE      varchar(5),
    WMS_MESSAGE NVARCHAR2(500),
    EQ_ZT         VARCHAR2(5) default 'N',
    WMS_DAT       DATE        default sysdate,
    EQ_DAT        DATE,
    EQ_REASON   NVARCHAR2(500)
);

comment on column FACILITY_INTERFACE.ID is '自增序号';
comment on column FACILITY_INTERFACE.REGION is '作业库区 R-密集库、
LV-左侧立库、
RV-右侧立库、
F-粮食库、
LC-01冷库、
RC-02冷库
P-平库';
comment on column FACILITY_INTERFACE.WMS_TYPE is '任务类型
1.整托任务
2.机械手拆垛任务
3.人工拆垛任务
4.上架任务
(
5-0=库内移动，
5-1=移出，
5-2=移入
)
6.库内盘点任务
7.库外盘点任务
8.空托盘上架任务
9.空托盘出库任务
10.往左立库拆跺
20.取消';

comment on column FACILITY_INTERFACE.WMS_MESSAGE is '任务信息 json字符串';
comment on column FACILITY_INTERFACE.EQ_ZT is '设备读取状态
N-未读取(默认)
S-取消成功
F-取消失败/其它异常';
comment on column FACILITY_INTERFACE.WMS_DAT is 'wms写入时间';
comment on column FACILITY_INTERFACE.EQ_DAT is '设备读取时间';
comment on column FACILITY_INTERFACE.EQ_REASON is '读取异常原因';

create sequence FACILITY_INTERFACE_id_seq;
create or replace trigger FACILITY_INTERFACE_trigger
before insert on FACILITY_INTERFACE  --before:执行DML等操作之前触发
for each row  --行级触发器
begin
   select FACILITY_INTERFACE_id_seq.nextval into :new.ID from dual;
end;

alter table FACILITY_INTERFACE
	add constraint FACILITY_INTERFACE_PK
		primary key (ID);
```

```
create table CONVEYOR.CONVEYOR_BACK
(
    ID            NUMBER,
    WMS_TYPE      varchar(5),
    WMS_MESSAGE NVARCHAR2(500),
    WMS_ZT        VARCHAR2(5) default 'N',
    WMS_DAT       DATE        default null,
    EQ_DAT        DATE        default sysdate,
    WMS_REASON  NVARCHAR2(500)
);

comment on column CONVEYOR.CONVEYOR_BACK.ID is '自增序号';
comment on column CONVEYOR.CONVEYOR_BACK.WMS_TYPE is '任务类型
1.贴标任务
2.分拨扫描时间、状态
2.补货道口状态
3.越库拨扫描时间、状态';
comment on column CONVEYOR.CONVEYOR_BACK.WMS_MESSAGE is '任务信息 json字符串';
comment on column CONVEYOR.CONVEYOR_BACK.WMS_ZT is 'WMS读取状态
N-未读取(默认)
Y已读取';
comment on column CONVEYOR.CONVEYOR_BACK.WMS_DAT is 'wms读取时间';
comment on column CONVEYOR.CONVEYOR_BACK.EQ_DAT is '设备写入时间';
comment on column CONVEYOR.CONVEYOR_BACK.WMS_REASON is '读取异常原因';

create sequence CONVEYOR_BACK_id_seq;
create trigger CONVEYOR.CONVEYOR_BACK_TRIGGER
    before insert
    on CONVEYOR.CONVEYOR_BACK
    for each row
begin
    select CONVEYOR_BACK_id_seq.nextval into :new.ID from dual;
end;

alter table CONVEYOR_BACK
	add constraint CONVEYOR_BACK_PK
		primary key (ID);
```

```
create table CONVEYOR.CONVEYOR_INTERFACE
(
    ID            NUMBER,
    WMS_TYPE      varchar(5),
    WMS_MESSAGE NVARCHAR2(500),
    EQ_ZT         VARCHAR2(5) default 'N',
    WMS_DAT       DATE        default sysdate,
    EQ_DAT        DATE,
    EQ_REASON   NVARCHAR2(500)
);
comment on column CONVEYOR.CONVEYOR_INTERFACE.ID is '自增序号';
comment on column CONVEYOR.CONVEYOR_INTERFACE.WMS_TYPE is '任务类型
1.分拣贴标
2.补货信息
3.越库信息';
comment on column CONVEYOR.CONVEYOR_INTERFACE.WMS_MESSAGE is '任务信息 json字符串';
comment on column CONVEYOR.CONVEYOR_INTERFACE.EQ_ZT is '设备读取状态
N-未读取(默认)
Y已读取';
comment on column CONVEYOR.CONVEYOR_INTERFACE.WMS_DAT is 'wms写入时间';
comment on column CONVEYOR.CONVEYOR_INTERFACE.EQ_DAT is '设备读取时间';
comment on column CONVEYOR.CONVEYOR_INTERFACE.EQ_REASON is '读取异常原因';

create sequence CONVEYOR_INTERFACE_id_seq;
create trigger CONVEYOR.CONVEYOR_INTERFACE_TRIGGER
    before insert
    on CONVEYOR.CONVEYOR_INTERFACE
    for each row
begin
    select CONVEYOR_INTERFACE_id_seq.nextval into :new.ID from dual;
end;

alter table CONVEYOR_INTERFACE
	add constraint CONVEYOR_INTERFACE_PK
		primary key (ID);
```

create table rdc
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	area                  		number(22,5) default 0 not null,
	address 					nvarchar2(100),
	db_ip 						varchar2(30),
	db_type 					varchar2(30),
	db_schema 					varchar2(30),
	db_port 					number default 0 not null,
	db_version 					varchar2(30),
	db_source					varchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table rdc add constraint pk_rdc primary key (row_id) using index;
create unique index uidx_rdc on rdc (rdc_id);
comment on table rdc is '物流中心';
comment on column rdc.row_id is 'uuid主键';
comment on column rdc.rdc_id is '物流中心';
comment on column rdc.descr is '物流中心描述';
comment on column rdc.area is '面积';
comment on column rdc.address is '地址';
comment on column rdc.db_ip is '数据库IP';
comment on column rdc.db_type is '数据库类型:oracle/mysql';
comment on column rdc.db_schema is '数据库名称';
comment on column rdc.db_port is '数据库端口';
comment on column rdc.db_version is '数据库版本';
comment on column rdc.db_source is '数据源';
comment on column rdc.udf1 is '用户自定义1';
comment on column rdc.udf2 is '用户自定义2';
comment on column rdc.udf3 is '用户自定义3';
comment on column rdc.udf4 is '用户自定义4';
comment on column rdc.udf5 is '用户自定义5';
comment on column rdc.add_id is '记录人';
comment on column rdc.add_name is '记录人姓名';
comment on column rdc.add_date is '记录时间';
comment on column rdc.edit_id is '编辑人';
comment on column rdc.edit_name is '编辑人姓名';
comment on column rdc.edit_date is '编辑时间';

create table sys_version
(
  system_id 					varchar2(30) not null,
  ver 							nvarchar2(10) not null,
  last_ver 						nvarchar2(10),
  edit_id 						varchar2(20),
  edit_name						nvarchar2(20),
  edit_date						date
);
alter table sys_version add constraint pk_sys_version primary key (system_id) using index;
comment on table sys_version is '版本信息';
comment on column sys_version.system_id is '系统:Android-RF/Wince-RF';
comment on column sys_version.ver is '版本号';
comment on column sys_version.last_ver is '上次版本号';
comment on column sys_version.edit_id is '编辑人';
comment on column sys_version.edit_name is '编辑人姓名';
comment on column sys_version.edit_date is '编辑时间';
insert into sys_version (system_id,ver,last_ver,edit_id,edit_name,edit_date) values 
('Android-RF','0.1','0.0','admin','管理员',sysdate);
insert into sys_version (system_id,ver,last_ver,edit_id,edit_name,edit_date) values 
('Wince-RF','0.1','0.0','admin','管理员',sysdate);

create table dictionary
(
	row_id						varchar2(32) not null,
  	dic_name 					varchar2(30) not null,
    descr        				nvarchar2(60) not null,
    order_by      				number default 0 not null,
    udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    editable     				nvarchar2(1) default '是' not null,
    active       				nvarchar2(1) default '是' not null,
    notes        				nvarchar2(60),
    add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table dictionary add constraint pk_dictionary primary key (row_id) using index;
create unique index uidx_dictionary on dictionary (dic_name);
comment on table dictionary is '基础数据表头';
comment on column dictionary.row_id is 'uuid主键';
comment on column dictionary.dic_name is '基础数据编码';
comment on column dictionary.descr is '描述';
comment on column dictionary.order_by is '排序';
comment on column dictionary.udf1 is '用户自定义1';
comment on column dictionary.udf2 is '用户自定义2';
comment on column dictionary.udf3 is '用户自定义3';
comment on column dictionary.udf4 is '用户自定义4';
comment on column dictionary.udf5 is '用户自定义5';
comment on column dictionary.editable is '是否可编辑';
comment on column dictionary.active is '是否有效';
comment on column dictionary.notes is '备注';
comment on column dictionary.add_id is '记录人';
comment on column dictionary.add_name is '记录人姓名';
comment on column dictionary.add_date is '记录时间';
comment on column dictionary.edit_id is '编辑人';
comment on column dictionary.edit_name is '编辑人姓名';
comment on column dictionary.edit_date is '编辑时间';

create table dictionary_list
(
	row_id						varchar2(32) not null,
	dic_name 					varchar2(30) not null,
	code         				varchar2(30) not null,
    descr        				nvarchar2(60) not null,
    order_by      				number default 0 not null,
    udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    notes        				nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table dictionary_list add constraint pk_dictionary_list primary key (row_id) using index;
create unique index uidx_dictionary_list on dictionary_list (dic_name,code);
comment on table dictionary_list is '基础数据明细	';
comment on column dictionary_list.row_id is 'uuid主键';
comment on column dictionary_list.dic_name is '基础数据编码';
comment on column dictionary_list.code is '子项编码';
comment on column dictionary_list.descr is '描述';
comment on column dictionary_list.order_by is '排序';
comment on column dictionary_list.udf1 is '用户自定义1';
comment on column dictionary_list.udf2 is '用户自定义2';
comment on column dictionary_list.udf3 is '用户自定义3';
comment on column dictionary_list.notes is '备注';
comment on column dictionary_list.add_id is '记录人';
comment on column dictionary_list.add_name is '记录人姓名';
comment on column dictionary_list.add_date is '记录时间';
comment on column dictionary_list.edit_id is '编辑人';
comment on column dictionary_list.edit_name is '编辑人姓名';
comment on column dictionary_list.edit_date is '编辑时间';

create table city
(
	row_id						varchar2(32) not null,
	city_code					varchar2(30) not null,
	descr						nvarchar2(60) not null,
  	province 					nvarchar2(30) not null,
  	country						nvarchar2(50) not null,
  	zip_code  					varchar2(10),
  	area_code  					varchar2(10),
  	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table city add constraint pk_city primary key (row_id) using index;
create unique index uidx_city on city (city_code);
comment on table city is '城市编码';
comment on column city.row_id is 'uuid主键';
comment on column city.city_code is '城市编码';
comment on column city.descr is '城市';
comment on column city.province is '省份';
comment on column city.country is '国家';
comment on column city.zip_code is '邮编';
comment on column city.area_code is '区号';
comment on column city.udf1 is '用户自定义1';
comment on column city.udf2 is '用户自定义2';
comment on column city.udf3 is '用户自定义3';
comment on column city.add_id is '记录人';
comment on column city.add_name is '记录人姓名';
comment on column city.add_date is '记录时间';
comment on column city.edit_id is '编辑人';
comment on column city.edit_name is '编辑人姓名';
comment on column city.edit_date is '编辑时间';

create table department
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	parent_id					varchar2(32) default '0' not null,
	dept_id						varchar2(30) not null,
	descr						nvarchar2(60) not null,
	owner_id       				varchar2(30),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table department add constraint pk_department primary key (row_id) using index;
create unique index uidx_department on department (dept_id);
comment on table department is '部门组织';
comment on column department.row_id is 'uuid主键';
comment on column department.rdc_id is '物流中心';
comment on column department.parent_id is '上级部门';
comment on column department.dept_id is '部门编码';
comment on column department.descr is '部门描述';
comment on column department.owner_id is '货主';
comment on column department.udf1 is '用户自定义1';
comment on column department.udf2 is '用户自定义2';
comment on column department.udf3 is '用户自定义3';
comment on column department.notes is '备注';
comment on column department.add_id is '记录人';
comment on column department.add_name is '记录人姓名';
comment on column department.add_date is '记录时间';
comment on column department.edit_id is '编辑人';
comment on column department.edit_name is '编辑人姓名';
comment on column department.edit_date is '编辑时间';

create table rdc_storer
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	customer_id		  			varchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table rdc_storer add constraint pk_rdc_storer primary key (row_id) using index;
comment on table rdc_storer is '物流中心与货主对应';
comment on column rdc_storer.row_id is 'uuid主键';
comment on column rdc_storer.rdc_id is '物流中心';
comment on column rdc_storer.customer_id is '货主';
comment on column rdc_storer.add_id is '记录人';
comment on column rdc_storer.add_name is '记录人姓名';
comment on column rdc_storer.add_date is '记录时间';
comment on column rdc_storer.edit_id is '编辑人';
comment on column rdc_storer.edit_name is '编辑人姓名';
comment on column rdc_storer.edit_date is '编辑时间';

create table users
(
	row_id						varchar2(32) not null,
	user_id 					varchar2(30) not null,
	user_name					nvarchar2(20) not null,
	user_password				varchar2(60) not null,
	phone						varchar2(20),
	email						varchar2(30),
	dept_id						varchar2(30),
	degree						varchar2(30),
	duty 						varchar2(30),
	sex 						nvarchar2(1) not null,
	born_date					date,
	work_date					date,
	status 						varchar2(10), 						
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
	check_commit_permission		varchar2(2) default 'N' not null,
	floor						nvarchar2(20),
	users_type					nvarchar2(20) default '物流用户' not null,
	customer_id 				varchar2(30)
);
alter table users add constraint pk_users primary key (row_id) using index;
create unique index uidx_users on users (user_id);
comment on table users is '系统用户';
comment on column users.row_id is 'uuid主键';
comment on column users.user_id is '用户编码';
comment on column users.user_name is '用户姓名';
comment on column users.user_password is '密码';
comment on column users.phone is '电话';
comment on column users.email is '邮箱';
comment on column users.dept_id is '部门编码';
comment on column users.degree is '学历';
comment on column users.duty is '职务';
comment on column users.sex is '性别';
comment on column users.born_date is '出生日期';
comment on column users.work_date is '工作日期';
comment on column users.status is '状态 0:禁用 1:可用';
comment on column users.udf1 is '用户自定义1';
comment on column users.udf2 is '用户自定义2';
comment on column users.udf3 is '用户自定义3';
comment on column users.add_id is '记录人';
comment on column users.add_name is '记录人姓名';
comment on column users.add_date is '记录时间';
comment on column users.edit_id is '编辑人';
comment on column users.edit_name is '编辑人姓名';
comment on column users.edit_date is '编辑时间';
comment on column users.check_commit_permission is '拆零复核提交权限';
comment on column users.floor is '楼层';


用户登陆记录表

```
create table BASE_AUTH.USER_LOGINLOG
(
    ROW_ID      VARCHAR2(32)                not null
        constraint PK_USER_LOGINLOG
            primary key,
    LOGIN_IP    VARCHAR2(30),
    RDC_ID      VARCHAR2(30)                not null,
    CLIENT_TYPE NVARCHAR2(30)               not null,
    LOG_TYPE    NVARCHAR2(30)               not null,
    UDF1        VARCHAR2(30),
    UDF2        VARCHAR2(30),
    UDF3        VARCHAR2(30),
    UDF4        VARCHAR2(30),
    UDF5        VARCHAR2(30),
    UDF6        VARCHAR2(30),
    UDF7        NUMBER,
    UDF8        NUMBER,
    UDF9        DATE,
    UDF10       DATE,
    ADD_ID      VARCHAR2(20)                not null,
    ADD_DATE    DATE        default sysdate not null,
    EDIT_ID     VARCHAR2(20),
    EDIT_DATE   DATE,
    ACTIVE      VARCHAR2(1) default 1       not null,
    NOTES       NVARCHAR2(60)
)
/

comment on column BASE_AUTH.USER_LOGINLOG.ROW_ID is 'uuid'
/

comment on column BASE_AUTH.USER_LOGINLOG.LOGIN_IP is '登陆ip'
/

comment on column BASE_AUTH.USER_LOGINLOG.RDC_ID is '物流中心id'
/

comment on column BASE_AUTH.USER_LOGINLOG.CLIENT_TYPE is '客户端类型'
/

comment on column BASE_AUTH.USER_LOGINLOG.LOG_TYPE is '登陆类型 0：登入 1：登出'
/

comment on column BASE_AUTH.USER_LOGINLOG.ADD_ID is '添加人'
/

comment on column BASE_AUTH.USER_LOGINLOG.ADD_DATE is '添加时间'
/

comment on column BASE_AUTH.USER_LOGINLOG.EDIT_ID is '修改人'
/

comment on column BASE_AUTH.USER_LOGINLOG.EDIT_DATE is '修改时间'
/

comment on column BASE_AUTH.USER_LOGINLOG.ACTIVE is '是否有效 0：无效 1：有效'
/

comment on column BASE_AUTH.USER_LOGINLOG.NOTES is '备注'
/
```

手持操作记录表

```
create table MASTER_BUSINESS.HAND_LOG
(
    ROW_ID            VARCHAR2(32)          not null
        constraint PK_HAND_LOG
            primary key,
    REQUEST_URL       VARCHAR2(50)          not null,
    BUZ_DESCRIPTION   NVARCHAR2(100),
    IN_PARAM          VARCHAR2(100)         not null,
    OUT_PARAM_CODE    VARCHAR2(50)          not null,
    OUT_PARAM_MSG     NVARCHAR2(500),
    OUT_PARAM_CONTENT NVARCHAR2(500),
    RDC_ID            VARCHAR2(30),
    UDF1              VARCHAR2(30),
    UDF2              VARCHAR2(30),
    UDF3              VARCHAR2(30),
    UDF4              VARCHAR2(30),
    UDF5              VARCHAR2(30),
    UDF6              VARCHAR2(30),
    UDF7              NUMBER,
    UDF8              NUMBER,
    UDF9              DATE,
    UDF10             DATE,
    ADD_ID            VARCHAR2(20)          not null,
    ADD_DATE          DATE        default sysdate,
    EDIT_ID           VARCHAR2(20),
    EDIT_DATE         DATE,
    ACTIVE            VARCHAR2(1) default 1 not null
)
/

comment on column MASTER_BUSINESS.HAND_LOG.ROW_ID is 'uuid'
/

comment on column MASTER_BUSINESS.HAND_LOG.REQUEST_URL is '请求url'
/

comment on column MASTER_BUSINESS.HAND_LOG.BUZ_DESCRIPTION is '业务描述'
/

comment on column MASTER_BUSINESS.HAND_LOG.IN_PARAM is '入参'
/

comment on column MASTER_BUSINESS.HAND_LOG.OUT_PARAM_CODE is '返回值编码'
/

comment on column MASTER_BUSINESS.HAND_LOG.OUT_PARAM_MSG is '返回值信息'
/

comment on column MASTER_BUSINESS.HAND_LOG.OUT_PARAM_CONTENT is '返回值内容'
/

comment on column MASTER_BUSINESS.HAND_LOG.RDC_ID is '物流中心'
/

comment on column MASTER_BUSINESS.HAND_LOG.ADD_ID is '添加人'
/

comment on column MASTER_BUSINESS.HAND_LOG.ADD_DATE is '添加时间'
/

comment on column MASTER_BUSINESS.HAND_LOG.EDIT_ID is '修改人'
/

comment on column MASTER_BUSINESS.HAND_LOG.EDIT_DATE is '修改时间'
/

comment on column MASTER_BUSINESS.HAND_LOG.ACTIVE is '是否可用 0：无效 1：有效'
/
```

create table resources
(
	row_id						varchar2(32) not null,
	resource_id					varchar2(30) not null,
	parent_id					varchar2(32) default '0' not null,
	descr 						nvarchar2(60) not null,
	active 						nvarchar2(1) default '是' not null,
	resource_type 				nvarchar2(30) not null,
	href						varchar2(60),
	icon_class					varchar2(30) not null,
	order_by 					number default 0 not null,
	resource_group 				nvarchar2(30) not null,
	resource_level				number not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table resources add constraint pk_resources primary key (row_id) using index;
create unique index uidx_resources on resources (resource_id);
comment on table resources is '功能模块';
comment on column resources.row_id is 'uuid主键';
comment on column resources.resource_id is '资源编码';
comment on column resources.parent_id is '上级资源';
comment on column resources.descr is '资源描述';
comment on column resources.active is '是否有效';
comment on column resources.resource_type is '资源类型:菜单/按钮';
comment on column resources.href is '资源地址';
comment on column resources.icon_class is '图标';
comment on column resources.order_by is '排序';
comment on column resources.resource_group is '资源组 PC/RF';
comment on column resources.resource_level is '功能层级';
comment on column resources.udf1 is '用户自定义1';
comment on column resources.udf2 is '用户自定义2';
comment on column resources.udf3 is '用户自定义3';
comment on column resources.notes is '备注';
comment on column resources.add_id is '记录人';
comment on column resources.add_name is '记录人姓名';
comment on column resources.add_date is '记录时间';
comment on column resources.edit_id is '编辑人';
comment on column resources.edit_name is '编辑人姓名';
comment on column resources.edit_date is '编辑时间';

create table role
(
	row_id						varchar2(32) not null,
	role_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	active 						nvarchar2(1) default '是' not null,
	role_type 					nvarchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table role add constraint pk_role primary key (row_id) using index;
create unique index uidx_role on role (role_id);
comment on table role is '角色';
comment on column role.row_id is 'uuid主键';
comment on column role.role_id is '角色编码';
comment on column role.descr is '角色描述';
comment on column role.active is '是否有效';
comment on column role.role_type is '角色类型:通用/物流中心';
comment on column role.udf1 is '用户自定义1';
comment on column role.udf2 is '用户自定义2';
comment on column role.udf3 is '用户自定义3';
comment on column role.notes is '备注';
comment on column role.add_id is '记录人';
comment on column role.add_name is '记录人姓名';
comment on column role.add_date is '记录时间';
comment on column role.edit_id is '编辑人';
comment on column role.edit_name is '编辑人姓名';
comment on column role.edit_date is '编辑时间';

create table rdc_user
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	user_id 					varchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table rdc_user add constraint pk_rdc_user primary key (row_id) using index;
create unique index uidx_rdc_user on rdc_user (rdc_id,user_id);
comment on table rdc_user is '物流中心用户';
comment on column rdc_user.row_id is 'uuid主键';
comment on column rdc_user.rdc_id is '物流中心';
comment on column rdc_user.user_id is '用户';
comment on column rdc_user.add_id is '记录人';
comment on column rdc_user.add_name is '记录人姓名';
comment on column rdc_user.add_date is '记录时间';
comment on column rdc_user.edit_id is '编辑人';
comment on column rdc_user.edit_name is '编辑人姓名';
comment on column rdc_user.edit_date is '编辑时间';

create table rdc_role
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	role_id 					varchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table rdc_role add constraint pk_rdc_role primary key (row_id) using index;
create unique index uidx_rdc_role on rdc_role (rdc_id,role_id);
comment on table rdc_role is '物流中心角色';
comment on column rdc_role.row_id is 'uuid主键';
comment on column rdc_role.rdc_id is '物流中心';
comment on column rdc_role.role_id is '角色';
comment on column rdc_role.add_id is '记录人';
comment on column rdc_role.add_name is '记录人姓名';
comment on column rdc_role.add_date is '记录时间';
comment on column rdc_role.edit_id is '编辑人';
comment on column rdc_role.edit_name is '编辑人姓名';
comment on column rdc_role.edit_date is '编辑时间';

create table role_resource
(
	row_id						varchar2(32) not null,
	role_id 					varchar2(30) not null,
	resource_id					varchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table role_resource add constraint pk_role_resource primary key (row_id) using index;
create unique index uidx_role_resource on role_resource (role_id,resource_id);
comment on table role_resource is '角色对应的功能';
comment on column role_resource.row_id is 'uuid主键';
comment on column role_resource.role_id is '角色';
comment on column role_resource.resource_id is '资源';
comment on column role_resource.add_id is '记录人';
comment on column role_resource.add_name is '记录人姓名';
comment on column role_resource.add_date is '记录时间';
comment on column role_resource.edit_id is '编辑人';
comment on column role_resource.edit_name is '编辑人姓名';
comment on column role_resource.edit_date is '编辑时间';

create table role_user
(
	row_id						varchar2(32) not null,
	role_id 					varchar2(30) not null,
	user_id 					varchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table role_user add constraint pk_role_user primary key (row_id) using index;
create unique index uidx_role_user on role_user (role_id,user_id);
comment on table role_user is '角色下的用户';
comment on column role_user.row_id is 'uuid主键';
comment on column role_user.role_id is '角色';
comment on column role_user.user_id is '用户';
comment on column role_user.add_id is '记录人';
comment on column role_user.add_name is '记录人姓名';
comment on column role_user.add_date is '记录时间';
comment on column role_user.edit_id is '编辑人';
comment on column role_user.edit_name is '编辑人姓名';
comment on column role_user.edit_date is '编辑时间';

create table wms_config
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	config_no 					varchar2(30) not null,
  	category 					nvarchar2(30) not null,
  	descr    					nvarchar2(60) not null,
  	value    					nvarchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table wms_config add constraint pk_wms_config primary key (row_id) using index;
comment on table wms_config is '系统配置表';
comment on column wms_config.row_id is 'uuid主键';
comment on column wms_config.rdc_id is '物流中心';
comment on column wms_config.config_no is '编码';
comment on column wms_config.category is '所属目录';
comment on column wms_config.descr is '描述';
comment on column wms_config.value is '值';
comment on column wms_config.add_id is '记录人';
comment on column wms_config.add_name is '记录人姓名';
comment on column wms_config.add_date is '记录时间';
comment on column wms_config.edit_id is '编辑人';
comment on column wms_config.edit_name is '编辑人姓名';
comment on column wms_config.edit_date is '编辑时间';

create table owner
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id					varchar2(30) not null,
	descr  						nvarchar2(60) not null,
	owner_type					varchar2(30),
	contact						nvarchar2(20),
	phone						varchar2(20),
	email						varchar2(30),
	fax							varchar2(20),
	bill_contact				nvarchar2(20),
	bill_phone					varchar2(20),
    bill_email					varchar2(20),
    bill_fax					varchar2(20),
	address						nvarchar2(100),
    reports_mould				varchar2(20),
    allocate_strategy 			varchar2(20),
    vat							varchar2(20),
    city_code					varchar2(30),
    calc_putaway_loc  			nvarchar2(1) default '是' not null,
    calc_putaway_loc_point 		varchar2(20) default 'receipt' not null,
    multi_area_pallet 			nvarchar2(1) default '是' not null,
   	rotation_id	 		  		varchar2(20),
   	returns_loc 				varchar2(30),		
   	putaway_strategy			varchar2(20),
    auto_close_po				nvarchar2(1) default '否' not null,
    auto_close_asn				nvarchar2(1) default '否' not null,
    orders_sequence 			varchar2(20),
    alloc_short_shipment 		nvarchar2(1) default '是' not null,
    credit_limit				number(22,5) default 0 not null,
    valid_start_date 			date default sysdate-365 not null,
    valid_end_date   			date default sysdate+3650 not null,
    allow_commingled_lpn  		nvarchar2(1) default '是' not null,
    receipt_validation  		varchar2(20),
    minimum_percent				number(22,5) default 0 not null,
    container_group 			varchar2(30),
    lot_validation_id 			varchar2(30),
    short_strategy_id 			varchar2(30),
    udf1         				number(22,5),
    udf2         				number(22,5),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    udf6         				varchar2(50),
    udf7         				varchar2(50),
    udf8         				varchar2(50),
    udf9         				varchar2(50),
    udf10         				varchar2(50),
    notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table owner add constraint pk_owner primary key (row_id) using index;
create unique index uidx_owner on owner (rdc_id,owner_id);
comment on table owner is '货主';
comment on column owner.row_id is 'uuid主键';
comment on column owner.rdc_id is '物流中心';
comment on column owner.owner_id is '货主';
comment on column owner.descr is '名称';
comment on column owner.owner_type is '类型';
comment on column owner.contact is '联系人';
comment on column owner.phone is '联系人电话';
comment on column owner.email is '联系人邮箱';
comment on column owner.fax is '联系人传真';
comment on column owner.bill_contact is '付款联系人';
comment on column owner.bill_phone is '付款联系人电话';
comment on column owner.bill_email is '付款联系人邮箱';
comment on column owner.bill_fax is '付款联系人传真';
comment on column owner.address is '地址';
comment on column owner.reports_mould is '打印模板';
comment on column owner.allocate_strategy is '分配策略';
comment on column owner.vat is '增值税ID';
comment on column owner.city_code is '城市';
comment on column owner.calc_putaway_loc is '是否计算上架库位';
comment on column owner.calc_putaway_loc_point is '计算上架库位节点:receipt/putaway';
comment on column owner.multi_area_pallet is '允许多区彩虹托盘上架';
comment on column owner.rotation_id is '库存周转';
comment on column owner.returns_loc is '退货接收库位';
comment on column owner.putaway_strategy is '上架策略';
comment on column owner.auto_close_po is '自动结算PO';
comment on column owner.auto_close_asn is '自动结算ASN';
comment on column owner.orders_sequence is '订单顺序策略';
comment on column owner.alloc_short_shipment is '允许部分出货';
comment on column owner.credit_limit is '信用限额';
comment on column owner.valid_start_date is '开始有效时间';
comment on column owner.valid_end_date is '结束有效时间';
comment on column owner.allow_commingled_lpn is '是否允许混放LPN';
comment on column owner.receipt_validation is '收货验证规则';
comment on column owner.minimum_percent is '接收量占订单量所允许的最少百分比';
comment on column owner.container_group is '容器组';
comment on column owner.lot_validation_id is '批属性验证编码';
comment on column owner.short_strategy_id is '短拣策略编码';
comment on column owner.udf1 is '用户自定义1';
comment on column owner.udf2 is '用户自定义2';
comment on column owner.udf3 is '用户自定义3';
comment on column owner.udf4 is '用户自定义4';
comment on column owner.udf5 is '用户自定义5';
comment on column owner.udf6 is '用户自定义6';
comment on column owner.udf7 is '用户自定义7';
comment on column owner.udf8 is '用户自定义8';
comment on column owner.udf9 is '用户自定义9';
comment on column owner.udf10 is '用户自定义10';
comment on column owner.notes is '备注';
comment on column owner.add_id is '记录人';
comment on column owner.add_name is '记录人姓名';
comment on column owner.add_date is '记录时间';
comment on column owner.edit_id is '编辑人';
comment on column owner.edit_name is '编辑人姓名';
comment on column owner.edit_date is '编辑时间';

create table vendor
(
	row_id						varchar2(32) not null,
	owner_id       				varchar2(30),
	vendor_id					varchar2(30) not null,
	descr  						nvarchar2(60) not null,
	vendor_type					varchar2(30),
	contact						nvarchar2(20),
	phone						varchar2(20),
	email						varchar2(30),
	fax							varchar2(20),
	address						nvarchar2(100),
    reports_mould				varchar2(20),
    vat							varchar2(20),
    city_code					varchar2(30),
    udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table vendor add constraint pk_vendor primary key (row_id) using index;
create unique index uidx_vendor on vendor (vendor_id);
comment on table vendor is '供应商';
comment on column vendor.row_id is 'uuid主键';
comment on column vendor.owner_id is '货主';
comment on column vendor.vendor_id is '供应商';
comment on column vendor.descr is '名称';
comment on column vendor.vendor_type is '类型';
comment on column vendor.contact is '联系人';
comment on column vendor.phone is '联系人电话';
comment on column vendor.email is '联系人邮箱';
comment on column vendor.fax is '传真';
comment on column vendor.address is '地址';
comment on column vendor.reports_mould is '打印模板';
comment on column vendor.vat is '增值税ID';
comment on column vendor.city_code is '城市';
comment on column vendor.udf1 is '用户自定义1';
comment on column vendor.udf2 is '用户自定义2';
comment on column vendor.udf3 is '用户自定义3';
comment on column vendor.udf4 is '用户自定义4';
comment on column vendor.udf5 is '用户自定义5';
comment on column vendor.notes is '备注';
comment on column vendor.add_id is '记录人';
comment on column vendor.add_name is '记录人姓名';
comment on column vendor.add_date is '记录时间';
comment on column vendor.edit_id is '编辑人';
comment on column vendor.edit_name is '编辑人姓名';
comment on column vendor.edit_date is '编辑时间';

create table customer
(
	row_id						varchar2(32) not null,
	owner_id					varchar2(30),
	customer_id		  			varchar2(30) not null,
	descr  						nvarchar2(60) not null,
	customer_type				varchar2(30),
	contact						nvarchar2(20),
	phone						varchar2(20),
	email						varchar2(30),
	fax							varchar2(20),
	address						nvarchar2(100),
    reports_mould				varchar2(20),
    sorting_id					varchar2(20),
    city_code					varchar2(30),
    orders_sequence 			varchar2(30),
    case_sorter_id 				varchar2(30),
    piece_sorter_id 			varchar2(30),
    udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table customer add constraint pk_customer primary key (row_id) using index;
create unique index uidx_customer on customer (customer_id);
comment on table customer is '客户';
comment on column customer.row_id is 'uuid主键';
comment on column customer.owner_id is '货主';
comment on column customer.customer_id is '客户';
comment on column customer.descr is '名称';
comment on column customer.customer_type is '类型';
comment on column customer.contact is '联系人';
comment on column customer.phone is '联系人电话';
comment on column customer.email is '联系人邮箱';
comment on column customer.fax is '传真';
comment on column customer.address is '地址';
comment on column customer.reports_mould is '打印模板';
comment on column customer.sorting_id is '增值税ID';
comment on column customer.city_code is '城市';
comment on column customer.orders_sequence is '订单顺序策略';
comment on column customer.case_sorter_id is '整货分拣口';
comment on column customer.piece_sorter_id is '拆零分拣口';
comment on column customer.udf1 is '用户自定义1';
comment on column customer.udf2 is '用户自定义2';
comment on column customer.udf3 is '用户自定义3';
comment on column customer.udf4 is '用户自定义4';
comment on column customer.udf5 is '用户自定义5';
comment on column customer.notes is '备注';
comment on column customer.add_id is '记录人';
comment on column customer.add_name is '记录人姓名';
comment on column customer.add_date is '记录时间';
comment on column customer.edit_id is '编辑人';
comment on column customer.edit_name is '编辑人姓名';
comment on column customer.edit_date is '编辑时间';

create table carrier
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	carrier_id		  			varchar2(30) not null,
	descr  						nvarchar2(60) not null,
	carrier_type				varchar2(30),
	contact						nvarchar2(20),
	phone						varchar2(20),
	email						varchar2(30),
	fax							varchar2(20),
	address						nvarchar2(100),
    reports_mould				varchar2(20),
    sorting_id					varchar2(20),
    city_code					varchar2(30),
    udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table carrier add constraint pk_carrier primary key (row_id) using index;
create unique index uidx_carrier on carrier (rdc_id,carrier_id);
comment on table carrier is '承运商';
comment on column carrier.row_id is 'uuid主键';
comment on column carrier.rdc_id is '物流中心';
comment on column carrier.carrier_id is '承运商';
comment on column carrier.descr is '名称';
comment on column carrier.carrier_type is '类型';
comment on column carrier.contact is '联系人';
comment on column carrier.phone is '联系人电话';
comment on column carrier.email is '联系人邮箱';
comment on column carrier.fax is '传真';
comment on column carrier.address is '地址';
comment on column carrier.reports_mould is '打印模板';
comment on column carrier.sorting_id is '增值税ID';
comment on column carrier.city_code is '城市';
comment on column carrier.udf1 is '用户自定义1';
comment on column carrier.udf2 is '用户自定义2';
comment on column carrier.udf3 is '用户自定义3';
comment on column carrier.udf4 is '用户自定义4';
comment on column carrier.udf5 is '用户自定义5';
comment on column carrier.notes is '备注';
comment on column carrier.add_id is '记录人';
comment on column carrier.add_name is '记录人姓名';
comment on column carrier.add_date is '记录时间';
comment on column carrier.edit_id is '编辑人';
comment on column carrier.edit_name is '编辑人姓名';
comment on column carrier.edit_date is '编辑时间';

create table sku
(
	row_id						varchar2(32) not null,
	owner_id					varchar2(30) not null,
	sku							varchar2(60) not null,
	hazmat_code 				varchar2(60) not null,
	descr  						nvarchar2(60) not null,
	sku_sort 					varchar2(20) not null,
	origin_place 				nvarchar2(60),
	specs 						varchar2(30),
	grade 						varchar2(20),
	uom 						varchar2(30) not null,
	pack_id						varchar2(20) not null,
	sku_abc						varchar2(10) default 'C' not null,
	active       				nvarchar2(1) default '是' not null,
	sku_group 					varchar2(20) not null,
	lot_validation_id 			varchar2(30),
	price1						number(22,5) default 0 not null,
	price2						number(22,5) default 0 not null,
	price3						number(22,5) default 0 not null,
	price4						number(22,5) default 0 not null,
	price5						number(22,5) default 0 not null,
	allocate_strategy 			varchar2(20),
	putaway_loc 				varchar2(30),
	putaway_area 				varchar2(30),
	container_group 			varchar2(30),
	cc_frequency				number default 0 not null,
	receipt_save_pack			nvarchar2(1) default '否' not null,
	inbound_qc_loc				varchar2(30),
	rotation_id  				varchar2(20),
	expire_days					number default 0 not null,
	safety_days                 number default 0 not null,
	safety_rate					number(22,5) default 0 not null,
	transport_mode				varchar2(30),
	rf_receipt_pack				varchar2(30),
	allow_consolidation			nvarchar2(1) default '是' not null,
	qty_by_customer				number(22,5) default 0 not null,
	pick_uom 					varchar2(20) default 'EA' not null,
	alloc_flowthru				nvarchar2(1) default '是' not null,
	putaway_strategy			varchar2(20),
	returns_loc 				varchar2(30),
	receipt_validation  		varchar2(20),
	stack_limit					number default 0 not null,
	pallets_limit_zone			number default 0 not null,
	manual_setup_required		nvarchar2(1) default '否' not null,
	outbound_qc_loc				varchar2(30),
	in_get_serial				nvarchar2(1) default '否' not null,
	out_get_serial				nvarchar2(1) default '否' not null,
	storage_type 				nvarchar2(30),
	irregular 					nvarchar2(1) default '否' not null,
	mul_pack					nvarchar2(1) default '否' not null,
	short_strategy_id 			varchar2(30),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table sku add constraint pk_sku primary key (row_id) using index;
create unique index uidx_sku on sku (owner_id,sku);
comment on table sku is '货品';
comment on column sku.row_id is 'uuid主键';
comment on column sku.owner_id	is '货主';
comment on column sku.sku is '货品';
comment on column sku.hazmat_code is '危险品代码';
comment on column sku.descr is '名称';
comment on column sku.sku_sort is '货品分类';
comment on column sku.origin_place is '产地';
comment on column sku.specs is '规格';
comment on column sku.grade is '等级';
comment on column sku.uom is '单位';
comment on column sku.pack_id is '包装编码';
comment on column sku.sku_abc is '货品ABC';
comment on column sku.active is '是否有效';
comment on column sku.sku_group is '货品组';
comment on column sku.lot_validation_id is '批属性验证编码';
comment on column sku.price1 is '价格1';
comment on column sku.price2 is '价格2';
comment on column sku.price3 is '价格3';
comment on column sku.price4 is '价格4';
comment on column sku.price5 is '价格5';
comment on column sku.allocate_strategy is '分配策略';
comment on column sku.putaway_loc is '默认上架库位';
comment on column sku.putaway_area is '上架区';
comment on column sku.container_group is '容器组';
comment on column sku.cc_frequency is '循环盘点频率';
comment on column sku.receipt_save_pack is '收货保存包装到批属性01';
comment on column sku.inbound_qc_loc is '入库质检库位';
comment on column sku.rotation_id is '库存周转';
comment on column sku.expire_days is '保质期天数';
comment on column sku.safety_days is '允许出库剩余天数';
comment on column sku.safety_rate is '允许出库剩余天数比例';
comment on column sku.transport_mode is '运输方式';
comment on column sku.rf_receipt_pack is '手持默认收货包装';
comment on column sku.allow_consolidation is '是否允许合并拣货';
comment on column sku.qty_by_customer is '超过该数量按客户拣货';
comment on column sku.pick_uom is '拣货单位:EA/CS/PL';
comment on column sku.alloc_flowthru is '是否允许机会性分配';
comment on column sku.putaway_strategy is '上架策略';
comment on column sku.returns_loc is '退货接收库位';
comment on column sku.receipt_validation is '收货验证规则';
comment on column sku.stack_limit is '堆栈层数限制';
comment on column sku.pallets_limit_zone is '每个区最大托盘数';
comment on column sku.manual_setup_required is '是否需要手工设置才能使用';
comment on column sku.outbound_qc_loc is '出库质检库位';
comment on column sku.in_get_serial is '入库获取序列号';
comment on column sku.out_get_serial is '出库获取序列号';
comment on column sku.storage_type is '存储方式';
comment on column sku.irregular is '是否不规则货品';
comment on column sku.mul_pack is '是否多包装';
comment on column sku.short_strategy_id is '短拣策略编码';
comment on column sku.udf1 is '用户自定义1';
comment on column sku.udf2 is '用户自定义2';
comment on column sku.udf3 is '用户自定义3';
comment on column sku.udf4 is '用户自定义4';
comment on column sku.udf5 is '用户自定义5';
comment on column sku.add_id is '记录人';
comment on column sku.add_name is '记录人姓名';
comment on column sku.add_date is '记录时间';
comment on column sku.edit_id is '编辑人';
comment on column sku.edit_name is '编辑人姓名';
comment on column sku.edit_date is '编辑时间';

create table sku_sort
(
	row_id						varchar2(32) not null,
	parent_id					varchar2(32) default '0' not null,
	sort_id						varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	levels						number default 0 not null,
    order_by      				number default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table sku_sort add constraint pk_sku_sort primary key (row_id) using index;
create unique index uidx_sku_sort on sku_sort (sort_id);
comment on table sku_sort is '货品分类';
comment on column sku_sort.row_id is 'uuid主键';
comment on column sku_sort.parent_id is '上级分类';
comment on column sku_sort.sort_id is '分类编码';
comment on column sku_sort.descr is '分类描述';
comment on column sku_sort.levels is '级别';
comment on column sku_sort.order_by is '排序';
comment on column sku_sort.udf1 is '用户自定义1';
comment on column sku_sort.udf2 is '用户自定义2';
comment on column sku_sort.udf3 is '用户自定义3';
comment on column sku_sort.udf4 is '用户自定义4';
comment on column sku_sort.udf5 is '用户自定义5';
comment on column sku_sort.add_id is '记录人';
comment on column sku_sort.add_name is '记录人姓名';
comment on column sku_sort.add_date is '记录时间';
comment on column sku_sort.edit_id is '编辑人';
comment on column sku_sort.edit_name is '编辑人姓名';
comment on column sku_sort.edit_date is '编辑时间';

create table alias_sku
(
	row_id						varchar2(32) not null,
	owner_id					varchar2(30) not null,
	sku							varchar2(60) not null,
	alias_sku_id   				varchar2(60) not null,
	alias_type					varchar2(20) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table alias_sku add constraint pk_alias_sku primary key (row_id) using index;
create unique index uidx_alias_sku on alias_sku (owner_id,sku,alias_sku_id);
comment on table alias_sku is '货品条码';
comment on column alias_sku.row_id is 'uuid主键';
comment on column alias_sku.owner_id is '货主';
comment on column alias_sku.sku is '货品';
comment on column alias_sku.alias_sku_id is '条码';
comment on column alias_sku.alias_type is '条码类型';
comment on column alias_sku.udf1 is '用户自定义1';
comment on column alias_sku.udf2 is '用户自定义2';
comment on column alias_sku.udf3 is '用户自定义3';
comment on column alias_sku.add_id is '记录人';
comment on column alias_sku.add_name is '记录人姓名';
comment on column alias_sku.add_date is '记录时间';
comment on column alias_sku.edit_id is '编辑人';
comment on column alias_sku.edit_name is '编辑人姓名';
comment on column alias_sku.edit_date is '编辑时间';

create table pack
(
	row_id						varchar2(32) not null,
	owner_id					varchar2(30) not null,
	sku							varchar2(60) not null,
	pack_id						varchar2(30) not null,
	pack_name					nvarchar2(30) not null,
	piece_qty					number(22,5) default 1 not null,
	piece_active				nvarchar2(1) default '是' not null,
	piece_replenish  			nvarchar2(1) default '是' not null,
	piece_cartonize  			nvarchar2(1) default '是' not null,
	piece_length				number(22,5) default 0 not null,
	piece_width					number(22,5) default 0 not null,
	piece_height				number(22,5) default 0 not null,
	piece_cube					number(22,5) default 0 not null,
	piece_gross_weight			number(22,5) default 0 not null,
	piece_net_weight			number(22,5) default 0 not null,
	piece_tare 					number(22,5) default 0 not null,
	inner_qty					number(22,5) default 0 not null,
	inner_active				nvarchar2(1) default '否' not null,
	inner_replenish  			nvarchar2(1) default '否' not null,
	inner_cartonize  			nvarchar2(1) default '否' not null,
	inner_length				number(22,5) default 0 not null,
	inner_width					number(22,5) default 0 not null,
	inner_height				number(22,5) default 0 not null,
	inner_cube					number(22,5) default 0 not null,
	inner_gross_weight			number(22,5) default 0 not null,
	inner_net_weight			number(22,5) default 0 not null,
	inner_tare					number(22,5) default 0 not null,
	case_qty					number(22,5) default 0 not null,
	case_active					nvarchar2(1) default '是' not null,
	case_replenish  			nvarchar2(1) default '是' not null,
	case_cartonize  			nvarchar2(1) default '是' not null,
	case_length					number(22,5) default 0 not null,
	case_width					number(22,5) default 0 not null,
	case_height					number(22,5) default 0 not null,
	case_cube					number(22,5) default 0 not null,
	case_gross_weight			number(22,5) default 0 not null,
	case_net_weight				number(22,5) default 0 not null,
	case_tare					number(22,5) default 0 not null,
	pallet_qty					number(22,5) default 0 not null,
	pallet_active				nvarchar2(1) default '否' not null,
	pallet_replenish  			nvarchar2(1) default '否' not null,
	pallet_cartonize  			nvarchar2(1) default '否' not null,
	pallet_length				number(22,5) default 0 not null,
	pallet_width				number(22,5) default 0 not null,
	pallet_height				number(22,5) default 0 not null,
	pallet_cube					number(22,5) default 0 not null,
	pallet_gross_weight			number(22,5) default 0 not null,
	pallet_net_weight			number(22,5) default 0 not null,
	pallet_tare					number(22,5) default 0 not null,
	other_qty					number(22,5) default 0 not null,
	other_active				nvarchar2(1) default '否' not null,
	other_replenish  			nvarchar2(1) default '否' not null,
	other_cartonize  			nvarchar2(1) default '否' not null,
	other_length				number(22,5) default 0 not null,
	other_width					number(22,5) default 0 not null,
	other_height				number(22,5) default 0 not null,
	other_cube					number(22,5) default 0 not null,
	other_gross_weight			number(22,5) default 0 not null,
	other_net_weight			number(22,5) default 0 not null,
	other_tare					number(22,5) default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table pack add constraint pk_pack primary key (row_id) using index;
create unique index uidx_pack on pack (owner_id,pack_id);
comment on table pack is '包装';
comment on column pack.row_id is 'uuid主键';
comment on column pack.owner_id is '货主';
comment on column pack.sku is '货品';
comment on column pack.pack_id is '包装编码';
comment on column pack.pack_name is '包装名称';
comment on column pack.piece_qty is '件数量';
comment on column pack.piece_active is '是否有效';
comment on column pack.piece_replenish is '是否允许补货';
comment on column pack.piece_cartonize is '是否允许装箱';
comment on column pack.piece_length is '长度';
comment on column pack.piece_width is '宽度';
comment on column pack.piece_height is '高度';
comment on column pack.piece_cube is '体积';
comment on column pack.piece_gross_weight is '毛重';
comment on column pack.piece_net_weight is '净重';
comment on column pack.piece_tare is '皮重';
comment on column pack.inner_qty is '内包装数量';
comment on column pack.inner_active is '是否有效';
comment on column pack.inner_replenish is '是否允许补货';
comment on column pack.inner_cartonize is '是否允许装箱';
comment on column pack.inner_length is '长度';
comment on column pack.inner_width is '宽度';
comment on column pack.inner_height is '高度';
comment on column pack.inner_cube is '体积';
comment on column pack.inner_gross_weight is '毛重';
comment on column pack.inner_net_weight is '净重';
comment on column pack.inner_tare is '皮重';
comment on column pack.case_qty	is '箱数量';
comment on column pack.case_active is '是否有效';
comment on column pack.case_replenish is '是否允许补货';
comment on column pack.case_cartonize is '是否允许装箱';
comment on column pack.case_length is '长度';
comment on column pack.case_width is '宽度';
comment on column pack.case_height is '高度';
comment on column pack.case_cube is '体积';
comment on column pack.case_gross_weight is '毛重';
comment on column pack.case_net_weight is '净重';
comment on column pack.case_tare is '皮重';
comment on column pack.pallet_qty is '托盘数量';
comment on column pack.pallet_active is '是否有效';
comment on column pack.pallet_replenish is '是否允许补货';
comment on column pack.pallet_cartonize is '是否允许装箱';
comment on column pack.pallet_length is '长度';
comment on column pack.pallet_width is '宽度';
comment on column pack.pallet_height is '高度';
comment on column pack.pallet_cube is '体积';
comment on column pack.pallet_gross_weight is '毛重';
comment on column pack.pallet_net_weight is '净重';
comment on column pack.pallet_tare is '皮重';
comment on column pack.other_qty is '其他包装数量';
comment on column pack.other_active is '是否有效';
comment on column pack.other_replenish is '是否允许补货';
comment on column pack.other_cartonize is '是否允许装箱';
comment on column pack.other_length is '长度';
comment on column pack.other_width is '宽度';
comment on column pack.other_height is '高度';
comment on column pack.other_cube is '体积';
comment on column pack.other_gross_weight is '毛重';
comment on column pack.other_net_weight	is '净重';
comment on column pack.other_tare is '皮重';
comment on column pack.udf1 is '用户自定义1';
comment on column pack.udf2 is '用户自定义2';
comment on column pack.udf3 is '用户自定义3';
comment on column pack.udf4 is '用户自定义4';
comment on column pack.udf5 is '用户自定义5';
comment on column pack.add_id is '记录人';
comment on column pack.add_name is '记录人姓名';
comment on column pack.add_date is '记录时间';
comment on column pack.edit_id is '编辑人';
comment on column pack.edit_name is '编辑人姓名';
comment on column pack.edit_date is '编辑时间';

create table warehouse
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	area                  		number(22,5) default 0 not null,
	address 					nvarchar2(60),
	start_using					date,
	end_using					date,
	udf1         				varchar2(50) not null,
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table warehouse add constraint pk_warehouse primary key (row_id) using index;
create unique index uidx_warehouse on warehouse (rdc_id,warehouse_id);
comment on table warehouse is '仓库';
comment on column warehouse.row_id is 'uuid主键';
comment on column warehouse.rdc_id is '所属物流中心';
comment on column warehouse.warehouse_id is '仓库编码';
comment on column warehouse.descr is '仓库描述';
comment on column warehouse.area is '面积';
comment on column warehouse.address is '地址';
comment on column warehouse.start_using is '启用时间';
comment on column warehouse.end_using is '停用时间';
comment on column warehouse.udf1 is '字母简称';
comment on column warehouse.udf2 is '用户自定义2';
comment on column warehouse.udf3 is '用户自定义3';
comment on column warehouse.udf4 is '用户自定义4';
comment on column warehouse.udf5 is '用户自定义5';
comment on column warehouse.add_id is '记录人';
comment on column warehouse.add_name is '记录人姓名';
comment on column warehouse.add_date is '记录时间';
comment on column warehouse.edit_id is '编辑人';
comment on column warehouse.edit_name is '编辑人姓名';
comment on column warehouse.edit_date is '编辑时间';

create table dock
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	dock_id 					varchar2(30) not null,
	area_id						varchar2(30) not null,
	in_available				nvarchar2(1) default '是' not null,
	out_available				nvarchar2(1) default '是' not null,
	open_from1					date,
	open_to1					date,
	open_from2					date,
	open_to2					date,
	area                  		number(22,5) default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table dock add constraint pk_dock primary key (row_id) using index;
create unique index uidx_dock on dock (rdc_id,dock_id);
comment on table dock is '月台';
comment on column dock.row_id is 'uuid主键';
comment on column dock.rdc_id is '物流中心';
comment on column dock.dock_id is '月台编码';
comment on column dock.area_id is '临近的库区';
comment on column dock.in_available is '是否可收货';
comment on column dock.out_available is '是否可发货';
comment on column dock.open_from1 is '第一段开放时间从';
comment on column dock.open_to1 is '第一段开放时间到';
comment on column dock.open_from2 is '第二段开放时间从';
comment on column dock.open_to2 is '第二段开放时间到';
comment on column dock.area is '面积';
comment on column dock.udf1 is '用户自定义1';
comment on column dock.udf2 is '用户自定义2';
comment on column dock.udf3 is '用户自定义3';
comment on column dock.add_id is '记录人';
comment on column dock.add_name is '记录人姓名';
comment on column dock.add_date is '记录时间';
comment on column dock.edit_id is '编辑人';
comment on column dock.edit_name is '编辑人姓名';
comment on column dock.edit_date is '编辑时间';

create table region
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	region_id					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	area                  		number(22,5) default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date,
	team_id 					varchar2(30)
);
alter table region add constraint pk_region primary key (row_id) using index;
create unique index uidx_region on region (rdc_id,region_id);
comment on table region is '区域';
comment on column region.row_id is 'uuid主键';
comment on column region.rdc_id is '物流中心';
comment on column region.warehouse_id is '仓库编码';
comment on column region.region_id is '区域编码';
comment on column region.descr is '区域描述';
comment on column region.area is '面积';
comment on column region.udf1 is '用户自定义1';
comment on column region.udf2 is '用户自定义2';
comment on column region.udf3 is '用户自定义3';
comment on column region.add_id is '记录人';
comment on column region.add_name is '记录人姓名';
comment on column region.add_date is '记录时间';
comment on column region.edit_id is '编辑人';
comment on column region.edit_name is '编辑人姓名';
comment on column region.edit_date is '编辑时间';
comment on column region.team_id is '班组编码';

create table area
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	region_id					varchar2(30) not null,
	area_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	inbound_loc 				varchar2(30) not null,
	outbound_loc 				varchar2(30) not null,
	piece_pick					nvarchar2(1) default '是' not null,
	inner_pick					nvarchar2(1) default '否' not null,
	case_pick					nvarchar2(1) default '否' not null,
	pallet_pick 				nvarchar2(1) default '否' not null,
	other_pick		  			nvarchar2(1) default '否' not null,
	clean_loc					nvarchar2(1) default '是' not null,
	area 						number(22,5) default 0 not null,
	repl_from_enable			nvarchar2(1) default '是' not null,
	repl_to_enable				nvarchar2(1) default '是' not null,
	repl_priority				number default 0 not null,
	max_qty						number(22,5) default 0 not null,
	max_cube					number(22,5) default 0 not null,
	max_weight					number(22,5) default 0 not null,
	max_casecnt					number(22,5) default 0 not null,
	pickto_loc					varchar2(30) default 'pickto' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date,
	diff_loc 					varchar2(30),
	defect_loc 					varchar2(30)
);
alter table area add constraint pk_area primary key (row_id) using index;
create unique index uidx_area on area (rdc_id,area_id);
comment on table area is '库区';
comment on column area.row_id is 'uuid主键';
comment on column area.rdc_id is '物流中心';
comment on column area.warehouse_id is '仓库编码';
comment on column area.region_id is '区域编码';
comment on column area.area_id is '库区编码';
comment on column area.descr is '描述';
comment on column area.inbound_loc is '入库落放库位';
comment on column area.outbound_loc is '出库落放库位';
comment on column area.piece_pick is '是否按件拣货';
comment on column area.inner_pick is '是否按内包装拣货';
comment on column area.case_pick is '是否按箱拣拣货';
comment on column area.pallet_pick is '是否按托盘拣货';
comment on column area.other_pick is '是否按其他包装方式拣货';
comment on column area.clean_loc is '是否清空库位式拣货';
comment on column area.area is '面积';
comment on column area.repl_from_enable is '是否允许从该区生成补货任务';
comment on column area.repl_to_enable is '是否允许补货到该区';
comment on column area.repl_priority is '补货优先级';
comment on column area.max_qty is '存储数量限制';
comment on column area.max_cube is '存储体积限制';
comment on column area.max_weight is '存储重量限制';
comment on column area.max_casecnt is '存储箱数限制';
comment on column area.pickto_loc is '拣货后库存转移库位';
comment on column area.udf1 is '用户自定义1';
comment on column area.udf2 is '用户自定义2';
comment on column area.udf3 is '用户自定义3';
comment on column area.udf4 is '用户自定义4';
comment on column area.udf5 is '用户自定义5';
comment on column area.add_id is '记录人';
comment on column area.add_name is '记录人姓名';
comment on column area.add_date is '记录时间';
comment on column area.edit_id is '编辑人';
comment on column area.edit_name is '编辑人姓名';
comment on column area.edit_date is '编辑时间';
comment on column area.diff_loc is '差异库位';
comment on column area.defect_loc is '残次库位';

create table lane
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	lane_id						varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table lane add constraint pk_lane primary key (row_id) using index;
create unique index uidx_lane on lane (rdc_id,warehouse_id,lane_id);
comment on table lane is '巷道';
comment on column lane.row_id is 'uuid主键';
comment on column lane.rdc_id is '物流中心';
comment on column lane.warehouse_id is '仓库编码';
comment on column lane.lane_id is '巷道编码';
comment on column lane.descr is '描述';
comment on column lane.udf1 is '用户自定义1';
comment on column lane.udf2 is '用户自定义2';
comment on column lane.udf3 is '用户自定义3';
comment on column lane.add_id is '记录人';
comment on column lane.add_name is '记录人姓名';
comment on column lane.add_date is '记录时间';
comment on column lane.edit_id is '编辑人';
comment on column lane.edit_name is '编辑人姓名';
comment on column lane.edit_date is '编辑时间';

create table loc_group
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	loc_group_id				varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table loc_group add constraint pk_loc_group primary key (row_id) using index;
create unique index uidx_loc_group on loc_group (rdc_id,warehouse_id,loc_group_id);
comment on table loc_group is '库位组';
comment on column loc_group.row_id is 'uuid主键';
comment on column loc_group.rdc_id is '物流中心';
comment on column loc_group.warehouse_id is '仓库编码';
comment on column loc_group.loc_group_id is '库位组编码';
comment on column loc_group.descr is '描述';
comment on column loc_group.udf1 is '用户自定义1';
comment on column loc_group.udf2 is '用户自定义2';
comment on column loc_group.udf3 is '用户自定义3';
comment on column loc_group.add_id is '记录人';
comment on column loc_group.add_name is '记录人姓名';
comment on column loc_group.add_date is '记录时间';
comment on column loc_group.edit_id is '编辑人';
comment on column loc_group.edit_name is '编辑人姓名';
comment on column loc_group.edit_date is '编辑时间';

create table loc
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	region_id					varchar2(30) not null,
	area_id 					varchar2(30) not null,
	lane_id						varchar2(30) not null,
	loc_group_id				varchar2(30) not null,
	loc_id 						varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	shelves_type				varchar2(30) not null,
	loc_type                 	varchar2(30) not null,
	putaway_logical				varchar2(30) not null,
	pick_logical				varchar2(30) not null,
	lose_id						nvarchar2(1) default '是' not null,
	loc_abc						varchar2(10) not null,
	commingle_sku 				nvarchar2(1) default '是' not null,
	commingle_lot 				nvarchar2(1) default '是' not null,
	pick_loc 	 				nvarchar2(1) default '否' not null,
	loc_line					number default 0 not null,
	loc_column					number default 0 not null,
	loc_level					number default 0 not null,
	xcoord						number default 0 not null,
	ycoord						number default 0 not null,
	zcoord						number default 0 not null,
	stack_limit 				number default 0 not null,
	pallets_limit 				number default 0 not null,
	owner_id       				varchar2(30),
	sort_id						varchar2(30),
	sku 						varchar2(30),
	sku_property				varchar2(30) not null,
	max_qty						number(22,5) default 0 not null,
	min_qty						number(22,5) default 0 not null,
	replenishment_uom			varchar2(30),
	equipment_type				nvarchar2(20) not null,
	loc_length					number(22,5) default 0 not null,
	loc_width					number(22,5) default 0 not null,
	loc_height					number(22,5) default 0 not null,
	max_cube 					number(22,5) default 0 not null,
	max_weight 					number(22,5) default 0 not null,
	hold_id 					varchar2(30),
	status 						varchar2(10),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table loc add constraint pk_loc primary key (row_id) using index;
create unique index uidx_loc on loc (rdc_id,loc_id);
comment on table loc is '库位';
comment on column loc.row_id is 'uuid主键';
comment on column loc.rdc_id is '物流中心';
comment on column loc.warehouse_id is '仓库';
comment on column loc.region_id is '区域';
comment on column loc.area_id is '库区';
comment on column loc.lane_id is '巷道';
comment on column loc.loc_group_id is '库位组';
comment on column loc.loc_id is '库位';
comment on column loc.descr is '描述';
comment on column loc.shelves_type is '货架类型 密集库 自动库 高位货架 平面拆零 搁板拆零 电子标签';
comment on column loc.loc_type is '库位类型 CS:整箱存储 EA:拆零存储 PL:整托存储 NONE:不限 DOCK:集货';
comment on column loc.putaway_logical is '上架路线';
comment on column loc.pick_logical is '拣货路线';
comment on column loc.lose_id is '上架后是否丢弃lpn';
comment on column loc.loc_abc is '库位ABC';
comment on column loc.commingle_sku is '是否混放货品';
comment on column loc.commingle_lot is '是否混放批次';
comment on column loc.pick_loc is '是否拣货库位';
comment on column loc.loc_line is '排';
comment on column loc.loc_column is '列';
comment on column loc.loc_level is '层';
comment on column loc.xcoord is 'X坐标';
comment on column loc.ycoord is 'Y坐标';
comment on column loc.zcoord is 'Z坐标';
comment on column loc.stack_limit is '堆栈层数限制';
comment on column loc.pallets_limit is '托盘数限制';
comment on column loc.owner_id is '指定存放的货主';
comment on column loc.sort_id is '指定存放的货品分类';
comment on column loc.sku is '指定存放的货品';
comment on column loc.sku_property is '货物属性';
comment on column loc.max_qty is '拣货位绑定货品时存储上限';
comment on column loc.min_qty is '拣货位绑定货品时安全库存';
comment on column loc.replenishment_uom is '补货最小单位:EA/CS';
comment on column loc.equipment_type is '搬运设备';
comment on column loc.loc_length is '长度';
comment on column loc.loc_width is '宽度';
comment on column loc.loc_height is '高度';
comment on column loc.max_cube is '容积';
comment on column loc.max_weight is '载重量';
comment on column loc.hold_id is '冻结编码：01出库异常';
comment on column loc.status is '状态：可用/占用/不可用';
comment on column loc.udf1 is '用户自定义1';
comment on column loc.udf2 is '用户自定义2';
comment on column loc.udf3 is '用户自定义3';
comment on column loc.udf4 is '用户自定义4';
comment on column loc.udf5 is '用户自定义5';
comment on column loc.add_id is '记录人';
comment on column loc.add_name is '记录人姓名';
comment on column loc.add_date is '记录时间';
comment on column loc.edit_id is '编辑人';
comment on column loc.edit_name is '编辑人姓名';
comment on column loc.edit_date is '编辑时间';

create table wms_loc_wcs
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	lane_id						varchar2(30) not null,
	loc_id 						varchar2(30) not null,
	wcs_warehouse_id 			varchar2(30) not null,
	wcs_loc_id					varchar2(30) not null,
	inventory_sequence 			number not null,
	wcs_loc_x 					number default 0 not null,
	wcs_loc_y 					number default 0 not null,
	wcs_loc_z  					number default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table wms_loc_wcs add constraint pk_wms_loc_wcs primary key (row_id) using index;
create unique index uidx_wms_loc_wcs on wms_loc_wcs (rdc_id,loc_id,inventory_sequence);
create index idx_wms_loc_wcs_rw on wms_loc_wcs (rdc_id,wcs_loc_id);
comment on table wms_loc_wcs is '库位与自动库对应';
comment on column wms_loc_wcs.row_id is 'uuid主键';
comment on column wms_loc_wcs.rdc_id is '物流中心';
comment on column wms_loc_wcs.lane_id is '巷道';
comment on column wms_loc_wcs.loc_id is '库位';
comment on column wms_loc_wcs.wcs_warehouse_id is '设备库';
comment on column wms_loc_wcs.wcs_loc_id is '设备库位';
comment on column wms_loc_wcs.inventory_sequence is '库存顺序';
comment on column wms_loc_wcs.wcs_loc_x is '排';
comment on column wms_loc_wcs.wcs_loc_y is '列';
comment on column wms_loc_wcs.wcs_loc_z is '层';
comment on column wms_loc_wcs.udf1 is '用户自定义1';
comment on column wms_loc_wcs.udf2 is '用户自定义2';
comment on column wms_loc_wcs.udf3 is '用户自定义3';
comment on column wms_loc_wcs.add_id is '记录人';
comment on column wms_loc_wcs.add_name is '记录人姓名';
comment on column wms_loc_wcs.add_date is '记录时间';

create table inbound_type
(
	row_id						varchar2(32) not null,
	owner_id 					varchar2(30) not null,
	type_id						varchar2(30) not null,
	descr 						nvarchar2(60),
	multiple_receipt			nvarchar2(1) default '是' not null,
	require_qc					nvarchar2(1) default '是' not null,
	shelf_life					number(22,5) default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table inbound_type add constraint pk_inbound_type primary key (row_id) using index;
create unique index uidx_inbound_type on inbound_type (owner_id,type_id);
comment on table inbound_type is '收货单类型';
comment on column inbound_type.row_id is 'uuid主键';
comment on column inbound_type.owner_id is '货主';
comment on column inbound_type.type_id is '单据类型编码';
comment on column inbound_type.descr is '描述';
comment on column inbound_type.multiple_receipt is '是否允许多次收货';
comment on column inbound_type.require_qc is '是否需要质检';
comment on column inbound_type.shelf_life is '保质期比例内允许入库';
comment on column inbound_type.udf1 is '用户自定义1';
comment on column inbound_type.udf2 is '用户自定义2';
comment on column inbound_type.udf3 is '用户自定义3';
comment on column inbound_type.add_id is '记录人';
comment on column inbound_type.add_name is '记录人姓名';
comment on column inbound_type.add_date is '记录时间';
comment on column inbound_type.edit_id is '编辑人';
comment on column inbound_type.edit_name is '编辑人姓名';
comment on column inbound_type.edit_date is '编辑时间';

create table outbound_type
(
	row_id						varchar2(32) not null,
	owner_id 					varchar2(30) not null,
	type_id						varchar2(30) not null,
	descr 						nvarchar2(60),
	hold_allocation 			nvarchar2(1) default '否' not null,
	hold_id 					varchar2(30),
	allow_consolidation			nvarchar2(1) default '否' not null,
	allow_piece 				nvarchar2(1) default '否' not null,
	ignore_expire 				nvarchar2(1) default '否' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table outbound_type add constraint pk_outbound_type primary key (row_id) using index;
create unique index uidx_outbound_type on outbound_type (owner_id,type_id);
comment on table outbound_type is '订单类型';
comment on column outbound_type.row_id is 'uuid主键';
comment on column outbound_type.owner_id is '货主';
comment on column outbound_type.type_id is '单据类型编码';
comment on column outbound_type.descr is '描述';
comment on column outbound_type.hold_allocation is '是否允许冻结分配';
comment on column outbound_type.hold_id is '允许冻结分配的冻结编码';
comment on column outbound_type.allow_consolidation is '是否允许合并拣货';
comment on column outbound_type.allow_piece is '不可拆零货品是否允许拆零出';
comment on column outbound_type.ignore_expire is '是否忽略保质期控制';
comment on column outbound_type.udf1 is '用户自定义1';
comment on column outbound_type.udf2 is '用户自定义2';
comment on column outbound_type.udf3 is '用户自定义3';
comment on column outbound_type.add_id is '记录人';
comment on column outbound_type.add_name is '记录人姓名';
comment on column outbound_type.add_date is '记录时间';
comment on column outbound_type.edit_id is '编辑人';
comment on column outbound_type.edit_name is '编辑人姓名';
comment on column outbound_type.edit_date is '编辑时间';

create table sorter
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	sorter_id 					varchar2(30) not null,
	descr 						nvarchar2(60),
	location 					varchar2(30),
	sorter_usage				nvarchar2(30),
	exception 					nvarchar2(1) default '否' not null,
	active 						nvarchar2(1) default '是' not null,
 	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table sorter add constraint pk_sorter primary key (row_id) using index;
create unique index uidx_sorter on sorter (rdc_id,sorter_id);
comment on table sorter is '分拣口';
comment on column sorter.row_id is 'uuid主键';
comment on column sorter.rdc_id is '物流中心';
comment on column sorter.sorter_id is '分拣口';
comment on column sorter.descr is '描述';
comment on column sorter.location is '方位';
comment on column sorter.sorter_usage is '用途，例如:便利店/大卖场';
comment on column sorter.exception is '是否异常口';
comment on column sorter.active is '是否有效';
comment on column sorter.udf1 is '用户自定义1';
comment on column sorter.udf2 is '用户自定义2';
comment on column sorter.udf3 is '用户自定义3';
comment on column sorter.add_id is '记录人';
comment on column sorter.add_name is '记录人姓名';
comment on column sorter.add_date is '记录时间';
comment on column sorter.edit_id is '编辑人';
comment on column sorter.edit_name is '编辑人姓名';
comment on column sorter.edit_date is '编辑时间';

create table container
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	container_id 				varchar2(30) not null,
	container_type				nvarchar2(20) not null,
	warehouse_id				varchar2(30) not null,
	status 						varchar2(10) default '空闲' not null,
	max_weight       		 	number(22,5) default 0 not null,
	max_cube					number(22,5) default 0 not null,
	max_qty						number(22,5) default 0 not null,
	container_length			number(22,5) default 0 not null,
	container_width				number(22,5) default 0 not null,
	container_height			number(22,5) default 0 not null,
	customer_id 				varchar2(30),
  	print_count       			number default 0 not null,
  	container_group 			varchar2(30),
  	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date,
	occupy_id					varchar2(20),
  	occupy_name					nvarchar2(20),
  	occupy_date					date,
  	occupy_reason				nvarchar2(20),
  	release_id					varchar2(20),
  	release_name				nvarchar2(20),
  	release_date				date,
  	release_reason				nvarchar2(20)
);
alter table container add constraint pk_container primary key (row_id) using index;
create unique index uidx_container on container (rdc_id,container_id);
comment on table container is '容器';
comment on column container.row_id is 'uuid主键';
comment on column container.rdc_id is '物流中心';
comment on column container.container_id is '容器编码';
comment on column container.container_type is '容器类型:托盘PA/周转箱CS';
comment on column container.warehouse_id is '仓库编码';
comment on column container.status is '状态:空闲/占用';
comment on column container.max_weight is '最大承载重量';
comment on column container.max_cube is '最大承载体积';
comment on column container.max_qty is '最大承载数量';
comment on column container.container_length is '长度';
comment on column container.container_width is '宽度';
comment on column container.container_height is '高度';
comment on column container.customer_id is '所属客户';
comment on column container.print_count is '打印次数';
comment on column container.container_group is '容器组';
comment on column container.udf1 is '用户自定义1';
comment on column container.udf2 is '用户自定义2';
comment on column container.udf3 is '用户自定义3';
comment on column container.add_id is '记录人';
comment on column container.add_name is '记录人姓名';
comment on column container.add_date is '记录时间';
comment on column container.edit_id is '编辑人';
comment on column container.edit_name is '编辑人姓名';
comment on column container.edit_date is '编辑时间';
comment on column container.occupy_id is '占用人';
comment on column container.occupy_name is '占用人姓名';
comment on column container.occupy_date is '占用时间';
comment on column container.occupy_reason is '占用原因';
comment on column container.release_id is '释放人';
comment on column container.release_name is '释放人姓名';
comment on column container.release_date is '释放时间';
comment on column container.release_reason is '释放原因';

create table equipment
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	equipment_id 				varchar2(30) not null,
	descr 						nvarchar2(60),
	equipment_type				nvarchar2(20) not null,
	equipment_model 			varchar2(60) not null,
	purchase_date				date,
	max_weight					number(22,5) default 0 not null,
	max_reach					number(22,5) default 0 not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table equipment add constraint pk_equipment primary key (row_id) using index;
create unique index uidx_equipment on equipment (rdc_id,equipment_id);
comment on table equipment is '设备';
comment on column equipment.row_id is 'uuid主键';
comment on column equipment.rdc_id is '物流中心';
comment on column equipment.equipment_id is '设备编码';
comment on column equipment.descr is '设备描述';
comment on column equipment.equipment_type is '设备类型:平面拣选/中位拣选/高位叉车/自动库';
comment on column equipment.equipment_model is '设备型号';
comment on column equipment.purchase_date is '采购时间';
comment on column equipment.max_weight is '载重';
comment on column equipment.max_reach is '作业高度';
comment on column equipment.udf1 is '用户自定义1';
comment on column equipment.udf2 is '用户自定义2';
comment on column equipment.udf3 is '用户自定义3';
comment on column equipment.add_id is '记录人';
comment on column equipment.add_name is '记录人姓名';
comment on column equipment.add_date is '记录时间';
comment on column equipment.edit_id is '编辑人';
comment on column equipment.edit_name is '编辑人姓名';
comment on column equipment.edit_date is '编辑时间';

create table shipping_area_customer
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	loc_id 						varchar2(30) not null,
	customer_id 				varchar2(30) not null,
	order_by 					number default 0 not null,
	max_qty 					number default 0 not null,
	max_pallets					number default 0 not null,
 	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table shipping_area_customer add constraint pk_shipping_area_customer primary key (row_id) using index;
create unique index uidx_shipping_area_customer on shipping_area_customer (rdc_id,loc_id,customer_id);
comment on table shipping_area_customer is '集货区客户';
comment on column shipping_area_customer.row_id is 'uuid主键';
comment on column shipping_area_customer.rdc_id is '物流中心';
comment on column shipping_area_customer.loc_id is '集货区库位编码';
comment on column shipping_area_customer.customer_id is '客户编码';
comment on column shipping_area_customer.order_by is '所在位置排序';
comment on column shipping_area_customer.max_qty is '最多集货数量';
comment on column shipping_area_customer.max_pallets is '最多集货托盘数';
comment on column shipping_area_customer.udf1 is '用户自定义1';
comment on column shipping_area_customer.udf2 is '用户自定义2';
comment on column shipping_area_customer.udf3 is '用户自定义3';
comment on column shipping_area_customer.add_id is '记录人';
comment on column shipping_area_customer.add_name is '记录人姓名';
comment on column shipping_area_customer.add_date is '记录时间';
comment on column shipping_area_customer.edit_id is '编辑人';
comment on column shipping_area_customer.edit_name is '编辑人姓名';
comment on column shipping_area_customer.edit_date is '编辑时间';

create table ncount
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	count_id					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	count_type					varchar2(20) not null,
	cur_value					number not null,
	count_len					number not null,
	prefix						varchar2(20),
	postfix						varchar2(20),
	update_date					varchar2(8),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table ncount add constraint pk_ncount primary key (row_id) using index;
create unique index uidx_ncount on ncount (rdc_id,count_id);
comment on table ncount is '单号生成规则';
comment on column ncount.row_id is 'uuid主键';
comment on column ncount.rdc_id is '物流中心';
comment on column ncount.count_id is '规则编码';
comment on column ncount.descr is '规则描述';
comment on column ncount.count_type is '类型:00普通/01时间格式yyyymmdd';
comment on column ncount.cur_value is '当前流水号';
comment on column ncount.count_len is '单号长度';
comment on column ncount.prefix is '前缀';
comment on column ncount.postfix is '后缀';
comment on column ncount.update_date is '修改时间格式:20171208';
comment on column ncount.udf1 is '用户自定义1';
comment on column ncount.udf2 is '用户自定义2';
comment on column ncount.udf3 is '用户自定义3';
comment on column ncount.add_id is '记录人';
comment on column ncount.add_name is '记录人姓名';
comment on column ncount.add_date is '记录时间';
comment on column ncount.edit_id is '编辑人';
comment on column ncount.edit_name is '编辑人姓名';
comment on column ncount.edit_date is '编辑时间';

create table delivery_route
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	delivery_route_id			varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	order_by 					number default 0 not null,
	frequency_rate				varchar2(60),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table delivery_route add constraint pk_delivery_route primary key (row_id) using index;
create unique index uidx_delivery_route on delivery_route (rdc_id,delivery_route_id);
comment on table delivery_route is '配送路线';
comment on column delivery_route.row_id is 'uuid主键';
comment on column delivery_route.rdc_id is '物流中心';
comment on column delivery_route.delivery_route_id is '路线编码';
comment on column delivery_route.descr is '路线描述';
comment on column delivery_route.order_by is '路线顺序';
comment on column delivery_route.frequency_rate is '配送频率，使用时间配置规则';
comment on column delivery_route.udf1 is '用户自定义1';
comment on column delivery_route.udf2 is '用户自定义2';
comment on column delivery_route.udf3 is '用户自定义3';
comment on column delivery_route.add_id is '记录人';
comment on column delivery_route.add_name is '记录人姓名';
comment on column delivery_route.add_date is '记录时间';
comment on column delivery_route.edit_id is '编辑人';
comment on column delivery_route.edit_name is '编辑人姓名';
comment on column delivery_route.edit_date is '编辑时间';

create table delivery_route_stop
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	delivery_route_id			varchar2(30) not null,
	customer_id		  			varchar2(30) not null,
	stop 						varchar2(20) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table delivery_route_stop add constraint pk_delivery_route_stop primary key (row_id) using index;
create unique index uidx_delivery_route_stop on delivery_route_stop (rdc_id,delivery_route_id,customer_id);
comment on table delivery_route_stop is '配送路序';
comment on column delivery_route_stop.row_id is 'uuid主键';
comment on column delivery_route_stop.rdc_id is '物流中心';
comment on column delivery_route_stop.delivery_route_id is '路线编码';
comment on column delivery_route_stop.customer_id is '客户';
comment on column delivery_route_stop.stop is '站点顺序';
comment on column delivery_route_stop.udf1 is '用户自定义1';
comment on column delivery_route_stop.udf2 is '用户自定义2';
comment on column delivery_route_stop.udf3 is '用户自定义3';
comment on column delivery_route_stop.add_id is '记录人';
comment on column delivery_route_stop.add_name is '记录人姓名';
comment on column delivery_route_stop.add_date is '记录时间';
comment on column delivery_route_stop.edit_id is '编辑人';
comment on column delivery_route_stop.edit_name is '编辑人姓名';
comment on column delivery_route_stop.edit_date is '编辑时间';

create table printer
(
	row_id						varchar2(32) not null,
	rdc_id  					varchar2(30) not null,
	printer_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	printer_type 				nvarchar2(30) not null,
	label_width					number(22,5),
	label_height				number(22,5),
	printer_ip 					varchar2(30) not null,
	printer_port				number,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table printer add constraint pk_printer primary key (row_id) using index;
create unique index uidx_printer on printer (rdc_id,printer_id);
comment on table printer is '打印机主档';
comment on column printer.row_id is 'uuid主键';
comment on column printer.rdc_id is '物流中心';
comment on column printer.printer_id is '打印机编码';
comment on column printer.descr is '打印机描述';
comment on column printer.printer_type is '打印机类型';
comment on column printer.label_width is '标签宽度';
comment on column printer.label_height is '标签高度';
comment on column printer.printer_ip is 'IP';
comment on column printer.printer_port is '端口';
comment on column printer.udf1 is '用户自定义1';
comment on column printer.udf2 is '用户自定义2';
comment on column printer.udf3 is '用户自定义3';
comment on column printer.add_id is '记录人';
comment on column printer.add_name is '记录人姓名';
comment on column printer.add_date is '记录时间';
comment on column printer.edit_id is '编辑人';
comment on column printer.edit_name is '编辑人姓名';
comment on column printer.edit_date is '编辑时间';

create table reports_mould
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	reports_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	reports_type  				varchar2(30) not null,
	reports_path 				varchar2(100),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table reports_mould add constraint pk_reports_mould primary key (row_id) using index;
create unique index uidx_reports_mould on reports_mould (rdc_id,reports_id);
comment on table reports_mould is '打印模板';
comment on column reports_mould.row_id is 'uuid主键';
comment on column reports_mould.rdc_id is '物流中心';
comment on column reports_mould.reports_id is '模板编码';
comment on column reports_mould.descr is '模板描述';
comment on column reports_mould.reports_type is '模板类型';
comment on column reports_mould.reports_path is '模板路径';
comment on column reports_mould.udf1 is '用户自定义1';
comment on column reports_mould.udf2 is '用户自定义2';
comment on column reports_mould.udf3 is '用户自定义3';
comment on column reports_mould.add_id is '记录人';
comment on column reports_mould.add_name is '记录人姓名';
comment on column reports_mould.add_date is '记录时间';
comment on column reports_mould.edit_id is '编辑人';
comment on column reports_mould.edit_name is '编辑人姓名';
comment on column reports_mould.edit_date is '编辑时间';

create table qc_grade
(
	row_id						varchar2(32) not null,
	qc_grade_id					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	process_name 				nvarchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table qc_grade add constraint pk_qc_grade primary key (row_id) using index;
create unique index uidx_qc_grade on qc_grade (qc_grade_id);
comment on table qc_grade is '质检等级';
comment on column qc_grade.row_id is 'uuid主键';
comment on column qc_grade.qc_grade_id is '质检等级编码';
comment on column qc_grade.descr is '质检等级描述';
comment on column qc_grade.process_name is '所在流程';
comment on column qc_grade.udf1 is '用户自定义1';
comment on column qc_grade.udf2 is '用户自定义2';
comment on column qc_grade.udf3 is '用户自定义3';
comment on column qc_grade.add_id is '记录人';
comment on column qc_grade.add_name is '记录人姓名';
comment on column qc_grade.add_date is '记录时间';
comment on column qc_grade.edit_id is '编辑人';
comment on column qc_grade.edit_name is '编辑人姓名';
comment on column qc_grade.edit_date is '编辑时间';

create table po
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	po_id 						varchar2(30) not null,
	extern_po_id				varchar2(30) not null,
	po_type 					nvarchar2(30) not null,
	created_date 				date not null,
	expected_arrive 			date,
	vendor_id					varchar2(30),
	buyer_id					varchar2(30),
	buyer_descr 				nvarchar2(60),
	buyer_address 				nvarchar2(100),
	buyer_city 		 			nvarchar2(60),
	buyer_province 				nvarchar2(30),
  	buyer_country				nvarchar2(50),
  	buyer_zip_code  			varchar2(10),
	buyer_contact				nvarchar2(20),
	buyer_phone					varchar2(20),
	buyer_email					varchar2(30),
	buyer_fax					varchar2(20),
	carrier_id					varchar2(30),
	transport_mode				varchar2(30),
	qty_open 					number(22,5) not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table po add constraint pk_po primary key (row_id) using index;
create unique index uidx_po on po (rdc_id,po_id);
comment on table po is '采购单';
comment on column po.row_id is 'uuid主键';
comment on column po.rdc_id	is '物流中心';
comment on column po.owner_id is '货主';
comment on column po.po_id is 'PO单号';
comment on column po.extern_po_id is '外部单号';
comment on column po.po_type is 'PO类型';
comment on column po.created_date is '单据创建时间';
comment on column po.expected_arrive is '预计到达时间';
comment on column po.vendor_id is '供应商';
comment on column po.buyer_id is '付款方';
comment on column po.buyer_descr is '付款方描述';
comment on column po.buyer_address is '付款方地址';
comment on column po.buyer_city is '付款方城市';
comment on column po.buyer_province is '付款方省份';
comment on column po.buyer_country is '付款方国家';
comment on column po.buyer_zip_code is '付款方邮编';
comment on column po.buyer_contact is '付款方联系人';
comment on column po.buyer_phone is '付款方电话';
comment on column po.buyer_email is '付款方邮箱';
comment on column po.buyer_fax is '付款方传真';
comment on column po.carrier_id is '承运商';
comment on column po.transport_mode is '运输方式';
comment on column po.qty_open is '单据数量';
comment on column po.status is '状态';
comment on column po.udf1 is '用户自定义1';
comment on column po.udf2 is '用户自定义2';
comment on column po.udf3 is '用户自定义3';
comment on column po.udf4 is '用户自定义4';
comment on column po.udf5 is '用户自定义5';
comment on column po.notes is '备注';
comment on column po.add_id is '记录人';
comment on column po.add_name is '记录人姓名';
comment on column po.add_date is '记录时间';
comment on column po.edit_id is '编辑人';
comment on column po.edit_name is '编辑人姓名';
comment on column po.edit_date is '编辑时间';

create table po_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	po_id 						varchar2(30) not null,
	line_id						varchar2(30) not null,
	extern_id 					varchar2(30) not null,
	extern_line_id 				varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	qty 						number(22,5) not null,
	qty_received				number(22,5) not null,
	pack_id						varchar2(30) not null,
	price 						number(22,5) default 0 not null,
	origin_place 				nvarchar2(60),
	grade 						varchar2(20),
	qty_rejected 				number(22,5) default 0 not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table po_detail add constraint pk_po_detail primary key (row_id) using index;
create unique index uidx_po_detail on po_detail (rdc_id,po_id,line_id);
comment on table po_detail is '采购单明细';
comment on column po_detail.row_id is 'uuid主键';
comment on column po_detail.rdc_id is '物流中心';
comment on column po_detail.owner_id is '货主';
comment on column po_detail.po_id is 'PO单号';
comment on column po_detail.line_id is '行号';
comment on column po_detail.extern_id is '外部单号';
comment on column po_detail.extern_line_id is '外部行号';
comment on column po_detail.sku is '货品';
comment on column po_detail.sku_descr is '货品描述';
comment on column po_detail.qty is '计划数量';
comment on column po_detail.qty_received is '已接收数量';
comment on column po_detail.pack_id is '包装';
comment on column po_detail.price is '价格';
comment on column po_detail.origin_place is '产地';
comment on column po_detail.grade is '货品等级';
comment on column po_detail.qty_rejected is '拒收数量';
comment on column po_detail.status is '状态';
comment on column po_detail.udf1 is '用户自定义1';
comment on column po_detail.udf2 is '用户自定义2';
comment on column po_detail.udf3 is '用户自定义3';
comment on column po_detail.udf4 is '用户自定义4';
comment on column po_detail.udf5 is '用户自定义5';
comment on column po_detail.notes is '备注';
comment on column po_detail.add_id is '记录人';
comment on column po_detail.add_name is '记录人姓名';
comment on column po_detail.add_date is '记录时间';
comment on column po_detail.edit_id is '编辑人';
comment on column po_detail.edit_name is '编辑人姓名';
comment on column po_detail.edit_date is '编辑时间';

create table receipt_validation
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	receipt_validation_id		varchar2(30) not null,
	without_po 					nvarchar2(1) default '是' not null,
	without_asn 				nvarchar2(1) default '否' not null,
	without_po_detail 			nvarchar2(1) default '是' not null,
	without_asn_detail 			nvarchar2(1) default '否' not null,
	without_lpn 				nvarchar2(1) default '是' not null,
	validation_qty 				nvarchar2(1) default '是' not null,
	permit_excess_rate			number(22,5) default 1 not null,
	refuse_excess_rate			number(22,5) default 1 not null,
	permit_refuse_alert			nvarchar2(1) default '是' not null,
	required_excess_reason		nvarchar2(1) default '否' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table receipt_validation add constraint pk_receipt_validation primary key (row_id) using index;
create unique index uidx_receipt_validation on receipt_validation (rdc_id,receipt_validation_id);
comment on table receipt_validation is '收货验证规则';
comment on column receipt_validation.row_id is 'uuid主键';
comment on column receipt_validation.rdc_id	is '物流中心';
comment on column receipt_validation.receipt_validation_id is '验证规则编码';
comment on column receipt_validation.without_po is '是否允许无PO收货';
comment on column receipt_validation.without_asn is '是否允许无ASN收货';
comment on column receipt_validation.without_po_detail is '是否允许无PO明细收货';
comment on column receipt_validation.without_asn_detail is '是否允许无ASN明细收';
comment on column receipt_validation.without_lpn is '是否允许无LPN收货';
comment on column receipt_validation.validation_qty is '是否需要数量验证';
comment on column receipt_validation.permit_excess_rate is '该超量比例允许收货';
comment on column receipt_validation.refuse_excess_rate is '该超量比例外不允许收货';
comment on column receipt_validation.permit_refuse_alert is '实收和预收在两个比例之间时是否预警';
comment on column receipt_validation.required_excess_reason is '发生超收时是否需要输入原因代码';
comment on column receipt_validation.udf1 is '用户自定义1';
comment on column receipt_validation.udf2 is '用户自定义2';
comment on column receipt_validation.udf3 is '用户自定义3';
comment on column receipt_validation.add_id is '记录人';
comment on column receipt_validation.add_name is '记录人姓名';
comment on column receipt_validation.add_date is '记录时间';
comment on column receipt_validation.edit_id is '编辑人';
comment on column receipt_validation.edit_name is '编辑人姓名';
comment on column receipt_validation.edit_date is '编辑时间';

create table receipt
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	receipt_id 					varchar2(30) not null,
	type_id 	 				nvarchar2(30) not null,
	extern_receipt_id			varchar2(30) not null,
	po_id 						varchar2(30),
	order_id 					varchar2(30),
	created_date 				date not null,
	expected_arrive 			date,
	reality_arrive 				date,
	vendor_id					varchar2(30),
	carrier_id					varchar2(30),
	vehicle_number				varchar2(20),
	driver_name					nvarchar2(20),
	ship_address				nvarchar2(100),
	ship_city					nvarchar2(60),
	ship_contact 				nvarchar2(20),
	ship_phone					varchar2(20),
	priority					number default 0 not null, 
	qty_open 					number(22,5) not null,
	transport_mode				varchar2(30),
	allow_auto_receipt			nvarchar2(1) default '否' not null,
	closed_date 				date,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table receipt add constraint pk_receipt primary key (row_id) using index;
create unique index uidx_receipt on receipt (rdc_id,receipt_id);
comment on table receipt is '收货单';
comment on column receipt.row_id is 'uuid主键';
comment on column receipt.rdc_id is '物流中心';
comment on column receipt.owner_id is '货主';
comment on column receipt.receipt_id is '收货单';
comment on column receipt.type_id is '单据类型';
comment on column receipt.extern_receipt_id is '外部单号';
comment on column receipt.po_id is 'PO单号';
comment on column receipt.order_id is '发货单';
comment on column receipt.created_date is '单据创建时间';
comment on column receipt.expected_arrive is '预计到达时间';
comment on column receipt.reality_arrive is '实际到达时间';
comment on column receipt.vendor_id is '供应商';
comment on column receipt.carrier_id is '承运商';
comment on column receipt.vehicle_number is '车牌号';
comment on column receipt.driver_name is '司机';
comment on column receipt.ship_address is '发货地址';
comment on column receipt.ship_city is '发货城市';
comment on column receipt.ship_contact is '发货联系人';
comment on column receipt.ship_phone is '发货联系人电话';
comment on column receipt.priority is '优先级';
comment on column receipt.qty_open is '单据数量';
comment on column receipt.transport_mode is '运输方式';
comment on column receipt.allow_auto_receipt is '是否允许自动收货';
comment on column receipt.closed_date is '单据关闭时间';
comment on column receipt.status is '状态';
comment on column receipt.udf1 is '用户自定义1';
comment on column receipt.udf2 is '用户自定义2';
comment on column receipt.udf3 is '用户自定义3';
comment on column receipt.udf4 is '用户自定义4';
comment on column receipt.udf5 is '用户自定义5';
comment on column receipt.notes is '备注';
comment on column receipt.add_id is '记录人';
comment on column receipt.add_name is '记录人姓名';
comment on column receipt.add_date is '记录时间';
comment on column receipt.edit_id is '编辑人';
comment on column receipt.edit_name is '编辑人姓名';
comment on column receipt.edit_date is '编辑时间';

create table receipt_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id      	 			varchar2(30) not null,
	receipt_id					varchar2(30) not null,
	line_id						varchar2(30) not null,
	extern_id 					varchar2(30) not null,
	extern_line_id 				varchar2(30) not null,
	po_id 						varchar2(30),
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	qty 						number(22,5) not null,
	qty_received				number(22,5) not null,
	uom 						varchar2(30) not null,
	pack_id						varchar2(30) not null,
	price 						number(22,5) default 0 not null,
	origin_place 				nvarchar2(60),
	grade 						varchar2(20),
	qty_rejected 				number(22,5) default 0 not null,
	rejected_reason				nvarchar2(30),
	to_loc 						varchar2(30),
	to_lot						varchar2(20),
	to_id 						varchar2(30),
	inventory_hold_code 		varchar2(30),
	lot01 						varchar2(30),
	lot02 						varchar2(30),
	lot03 						varchar2(30),
	lot04 						varchar2(30),
	lot05 						varchar2(30),
	lot06 						varchar2(30),
	lot07 						varchar2(30),
	lot08 						varchar2(30),
	lot09 						varchar2(30),
	lot10 						varchar2(30),
	lot11 						varchar2(30),
	lot12 						varchar2(30),
	lot13 						varchar2(30),
	lot14 						varchar2(30),
	lot15 						date,
	lot16 						date,
	lot17 						date,
	lot18 						date,
	lot19 						date,
	lot20 						date,
	case_qty 					number(22,5),
	inner_qty 					number(22,5),
	pallet_qty					number(22,5),
	cube 						number(22,5),
	gross_weight 				number(22,5),
	net_weight 					number(22,5),
	other_unit1 				number(22,5),
	other_unit2 				number(22,5),
	qc_status 					varchar2(10) default '0' not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table receipt_detail add constraint pk_receipt_detail primary key (row_id) using index;
create unique index uidx_receipt_detail on receipt_detail (owner_id,receipt_id,line_id);
comment on table receipt_detail is '收货单明细';
comment on column receipt_detail.row_id is 'uuid主键';
comment on column receipt_detail.rdc_id	is '物流中心';
comment on column receipt_detail.owner_id is '货主';
comment on column receipt_detail.receipt_id is '收货单';
comment on column receipt_detail.line_id is '行号';
comment on column receipt_detail.extern_id is '外部单号';
comment on column receipt_detail.extern_line_id is '外部行号';
comment on column receipt_detail.po_id is 'PO单号';
comment on column receipt_detail.sku is 'PO货品';
comment on column receipt_detail.sku_descr is 'PO货品描述';
comment on column receipt_detail.qty is 'PO计划数量';
comment on column receipt_detail.qty_received is 'PO已接收数量';
comment on column receipt_detail.uom is '单位';
comment on column receipt_detail.pack_id is 'PO包装';
comment on column receipt_detail.price is '价格';
comment on column receipt_detail.origin_place is '产地';
comment on column receipt_detail.grade is '货品等级';
comment on column receipt_detail.qty_rejected is '拒收数量';
comment on column receipt_detail.rejected_reason is '拒收原因';
comment on column receipt_detail.to_loc is '收货至库位';
comment on column receipt_detail.to_lot is '收货至批次';
comment on column receipt_detail.to_id is '收货至ID';
comment on column receipt_detail.inventory_hold_code is '库存冻结编码';
comment on column receipt_detail.lot01 is '批属性01';
comment on column receipt_detail.lot02 is '批属性02';
comment on column receipt_detail.lot03 is '批属性03';
comment on column receipt_detail.lot04 is '批属性04';
comment on column receipt_detail.lot05 is '批属性05';
comment on column receipt_detail.lot06 is '批属性06';
comment on column receipt_detail.lot07 is '批属性07';
comment on column receipt_detail.lot08 is '批属性08';
comment on column receipt_detail.lot09 is '批属性09';
comment on column receipt_detail.lot10 is '批属性10';
comment on column receipt_detail.lot11 is '批属性11';
comment on column receipt_detail.lot12 is '批属性12';
comment on column receipt_detail.lot13 is '批属性13';
comment on column receipt_detail.lot14 is '批属性14';
comment on column receipt_detail.lot15 is '批属性15';
comment on column receipt_detail.lot16 is '批属性16';
comment on column receipt_detail.lot17 is '批属性17';
comment on column receipt_detail.lot18 is '批属性18';
comment on column receipt_detail.lot19 is '批属性19';
comment on column receipt_detail.lot20 is '批属性20';
comment on column receipt_detail.case_qty is '箱数量';
comment on column receipt_detail.inner_qty is '内包装数量';
comment on column receipt_detail.pallet_qty is '托盘数量';
comment on column receipt_detail.cube is '体积';
comment on column receipt_detail.gross_weight is '毛重';
comment on column receipt_detail.net_weight is '净重';
comment on column receipt_detail.other_unit1 is '其它单位1';
comment on column receipt_detail.other_unit2 is '其它单位2';
comment on column receipt_detail.qc_status is '质检状态';
comment on column receipt_detail.status is '状态';
comment on column receipt_detail.udf1 is '用户自定义1';
comment on column receipt_detail.udf2 is '用户自定义2';
comment on column receipt_detail.udf3 is '用户自定义3';
comment on column receipt_detail.udf4 is '用户自定义4';
comment on column receipt_detail.udf5 is '用户自定义5';
comment on column receipt_detail.notes is '备注';
comment on column receipt_detail.add_id is '记录人';
comment on column receipt_detail.add_name is '记录人姓名';
comment on column receipt_detail.add_date is '记录时间';
comment on column receipt_detail.edit_id is '编辑人';
comment on column receipt_detail.edit_name is '编辑人姓名';
comment on column receipt_detail.edit_date is '编辑时间';

create table receipt_group
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	receipt_group_id 			varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	vendor_id					varchar2(30) not null,
	receipt_id 					varchar2(30) not null,
	extern_receipt_id			varchar2(30) not null,
	type_id 	 				nvarchar2(30) not null,
	type_descr 					nvarchar2(60) not null,
	line_id						varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	sku_property				varchar2(30) not null,
	price 						number(22,5) default 0 not null,
	qty 						number(22,5) not null,
	qty_received				number(22,5) default 0 not null,
	qty_rejected 				number(22,5) default 0 not null,
	uom 						varchar2(30) not null,
	pack_id						varchar2(30) not null,
	pack_qty					number(22,5) default 1 not null,
	wave_id 					varchar2(30),
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table receipt_group add constraint pk_receipt_group primary key (row_id) using index;
create unique index uidx_receipt_group on receipt_group (rdc_id,receipt_group_id,receipt_id);
comment on table receipt_group is '收货分组号';
comment on column receipt_group.row_id is 'uuid主键';
comment on column receipt_group.rdc_id is '物流中心';
comment on column receipt_group.receipt_group_id is '收货分组号';
comment on column receipt_group.warehouse_id is '仓库';
comment on column receipt_group.owner_id is '货主';
comment on column receipt_group.vendor_id is '供应商';
comment on column receipt_group.receipt_id is '收货单';
comment on column receipt_group.extern_receipt_id is '外部单号';
comment on column receipt_group.type_id is '单据类型';
comment on column receipt_group.type_descr is '单据类型描述';
comment on column receipt_group.line_id is '行号';
comment on column receipt_group.sku is '货品';
comment on column receipt_group.sku_descr is '货品描述';
comment on column receipt_group.sku_property is '货物属性';
comment on column receipt_group.price is '价格';
comment on column receipt_group.qty is '计划数量';
comment on column receipt_group.qty_received is '已接收数量';
comment on column receipt_group.qty_rejected is '拒收数量';
comment on column receipt_group.uom is '单位';
comment on column receipt_group.pack_id is '包装编码';
comment on column receipt_group.pack_qty is '实际主包装含量';
comment on column receipt_group.wave_id is '波次';
comment on column receipt_group.status is '状态';
comment on column receipt_group.udf1 is '用户自定义1';
comment on column receipt_group.udf2 is '用户自定义2';
comment on column receipt_group.udf3 is '用户自定义3';
comment on column receipt_group.udf4 is '用户自定义4';
comment on column receipt_group.udf5 is '用户自定义5';
comment on column receipt_group.add_id is '记录人';
comment on column receipt_group.add_name is '记录人姓名';
comment on column receipt_group.add_date is '记录时间';
comment on column receipt_group.edit_id is '编辑人';
comment on column receipt_group.edit_name is '编辑人姓名';
comment on column receipt_group.edit_date is '编辑时间';

create table receipt_lpn
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	receipt_group_id 			varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	vendor_id					varchar2(30) not null,
	sku 						varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	sku_property				varchar2(30) not null,
	lot 						varchar2(20) not null,
	container_id 				varchar2(30) default ' ' not null,
	qty 						number(22,5) not null,
	qty_received				number(22,5) default 0 not null,
	qty_rejected 				number(22,5) default 0 not null,
	qty_putaway 				number(22,5) default 0 not null,
	uom 						varchar2(30) not null,
	pack_id						varchar2(30) not null,
	pack_qty					number(22,5) default 1 not null,
	putaway_type				varchar2(30) default '收货' not null,
	to_area                     varchar2(30),
	to_loc 						varchar2(30),
	loc_height					number(22,5) default 0 not null,
	lot01 						varchar2(30),
	lot02 						varchar2(30),
	lot03 						varchar2(30),
	lot04 						varchar2(30),
	lot05 						varchar2(30),
	lot06 						varchar2(30),
	lot07 						varchar2(30),
	lot08 						varchar2(30),
	lot09 						varchar2(30),
	lot10 						varchar2(30),
	lot11 						varchar2(30),
	lot12 						varchar2(30),
	lot13 						varchar2(30),
	lot14 						varchar2(30),
	lot15 						date,
	lot16 						date,
	lot17 						date,
	lot18 						date,
	lot19 						date,
	lot20 						date,
	status 						varchar2(10) not null,
    distributionflag			VARCHAR2(2) default 'N' not null,
    udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table receipt_lpn add constraint pk_receipt_lpn primary key (row_id) using index;
comment on table receipt_lpn is '收货明细';
comment on column receipt_lpn.row_id is 'uuid主键';
comment on column receipt_lpn.rdc_id is '物流中心';
comment on column receipt_lpn.receipt_group_id is '收货分组号';
comment on column receipt_lpn.warehouse_id is '仓库';
comment on column receipt_lpn.owner_id is '货主';
comment on column receipt_lpn.vendor_id is '供应商';
comment on column receipt_lpn.sku is '货品';
comment on column receipt_lpn.sku_descr is '货品描述';
comment on column receipt_lpn.sku_property is '货物属性';
comment on column receipt_lpn.lot is '批次';
comment on column receipt_lpn.container_id is '容器';
comment on column receipt_lpn.qty is '计划数量';
comment on column receipt_lpn.qty_received is '已接收数量';
comment on column receipt_lpn.qty_rejected is '拒收数量';
comment on column receipt_lpn.qty_putaway is '已经上架量';
comment on column receipt_lpn.uom is '单位';
comment on column receipt_lpn.pack_id is '包装';
comment on column receipt_lpn.pack_qty is '实际主包装含量';
comment on column receipt_lpn.putaway_type is '上架类型:收货/回库/异常口回库';
comment on column receipt_lpn.to_area is '上架区';
comment on column receipt_lpn.to_loc is '上架库位';
comment on column receipt_lpn.loc_height is '高度';
comment on column receipt_lpn.lot01 is '批属性01';
comment on column receipt_lpn.lot02 is '批属性02';
comment on column receipt_lpn.lot03 is '批属性03';
comment on column receipt_lpn.lot04 is '批属性04';
comment on column receipt_lpn.lot05 is '批属性05';
comment on column receipt_lpn.lot06 is '批属性06';
comment on column receipt_lpn.lot07 is '批属性07';
comment on column receipt_lpn.lot08 is '批属性08';
comment on column receipt_lpn.lot09 is '批属性09';
comment on column receipt_lpn.lot10 is '批属性10';
comment on column receipt_lpn.lot11 is '批属性11';
comment on column receipt_lpn.lot12 is '批属性12';
comment on column receipt_lpn.lot13 is '批属性13';
comment on column receipt_lpn.lot14 is '批属性14';
comment on column receipt_lpn.lot15 is '批属性15';
comment on column receipt_lpn.lot16 is '批属性16';
comment on column receipt_lpn.lot17 is '批属性17';
comment on column receipt_lpn.lot18 is '批属性18';
comment on column receipt_lpn.lot19 is '批属性19';
comment on column receipt_lpn.lot20 is '批属性20';
comment on column receipt_lpn.status is '状态:00初始状态/50上架完成';
comment on column receipt_lpn.distributionflag is '上架任务是否已下发给wcs N:否 Y:是';
comment on column receipt_lpn.udf1 is '用户自定义1';
comment on column receipt_lpn.udf2 is '用户自定义2';
comment on column receipt_lpn.udf3 is '用户自定义3';
comment on column receipt_lpn.udf4 is '用户自定义4';
comment on column receipt_lpn.udf5 is '用户自定义5';
comment on column receipt_lpn.add_id is '记录人';
comment on column receipt_lpn.add_name is '记录人姓名';
comment on column receipt_lpn.add_date is '记录时间';
comment on column receipt_lpn.edit_id is '编辑人';
comment on column receipt_lpn.edit_name is '编辑人姓名';
comment on column receipt_lpn.edit_date is '编辑时间';

create table crossdock
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	order_id 					varchar2(30) not null,
	extern_order_id 			varchar2(30) not null,
	type_id	  					varchar2(30) not null,
	owner_id 					varchar2(30) not null,
	po_id 						varchar2(30) not null,
	load_id   					varchar2(30),
	dock_id 					varchar2(30),
	delivery_route_id			varchar2(30),
	stop 						varchar2(20),
	delivery_date				date,
	allocate_strategy_id        varchar2(30) not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table crossdock add constraint pk_crossdock primary key (row_id) using index;
create unique index uidx_crossdock on crossdock (rdc_id,order_id);
comment on table crossdock is '越库单';
comment on column crossdock.row_id is 'uuid主键';
comment on column crossdock.rdc_id is '物流中心';
comment on column crossdock.order_id is '订单号';
comment on column crossdock.extern_order_id is '外部单号';
comment on column crossdock.type_id is '单据类型';
comment on column crossdock.owner_id is '货主';
comment on column crossdock.po_id is 'PO单号';
comment on column crossdock.load_id is '装载单号';
comment on column crossdock.dock_id is '越库月台';
comment on column crossdock.delivery_route_id is '路线';
comment on column crossdock.stop is '配送路序';
comment on column crossdock.delivery_date is '发货时间';
comment on column crossdock.allocate_strategy_id is '分配策略';
comment on column crossdock.status is '状态';
comment on column crossdock.udf1 is '用户自定义1';
comment on column crossdock.udf2 is '用户自定义2';
comment on column crossdock.udf3 is '用户自定义3';
comment on column crossdock.udf4 is '用户自定义4';
comment on column crossdock.udf5 is '用户自定义5';
comment on column crossdock.add_id is '记录人';
comment on column crossdock.add_name is '记录人姓名';
comment on column crossdock.add_date is '记录时间';
comment on column crossdock.edit_id is '编辑人';
comment on column crossdock.edit_name is '编辑人姓名';
comment on column crossdock.edit_date is '编辑时间';

create table crossdock_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	order_id 					varchar2(30) not null,
	line_id 					varchar2(30) not null,
	owner_id 					varchar2(30) not null,
	sku 						varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	qty 						number(22,5) not null,
	qty_shipped 				number(22,5) default 0 not null,
	qty_open 					number(22,5) not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table crossdock_detail add constraint pk_crossdock_detail primary key (row_id) using index;
create unique index uidx_crossdock_detail on crossdock_detail (rdc_id,order_id,line_id);
comment on table crossdock_detail is '越库单明细';
comment on column crossdock_detail.row_id is 'uuid主键';
comment on column crossdock_detail.rdc_id is '物流中心';
comment on column crossdock_detail.order_id is '订单号';
comment on column crossdock_detail.line_id is '行号';
comment on column crossdock_detail.owner_id is '货主';
comment on column crossdock_detail.sku is '货品';
comment on column crossdock_detail.sku_descr is '货品描述';
comment on column crossdock_detail.qty is '计划数量';
comment on column crossdock_detail.qty_shipped is '发运数量';
comment on column crossdock_detail.qty_open is '未结数量';
comment on column crossdock_detail.status is '状态';
comment on column crossdock_detail.udf1 is '用户自定义1';
comment on column crossdock_detail.udf2 is '用户自定义2';
comment on column crossdock_detail.udf3 is '用户自定义3';
comment on column crossdock_detail.add_id is '记录人';
comment on column crossdock_detail.add_name is '记录人姓名';
comment on column crossdock_detail.add_date is '记录时间';
comment on column crossdock_detail.edit_id is '编辑人';
comment on column crossdock_detail.edit_name is '编辑人姓名';
comment on column crossdock_detail.edit_date is '编辑时间';

create table inbound
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	receipt_id 					varchar2(30) not null,
	print_count 				number default 0 not null,
	receiver_id 				varchar2(20),
	receiver_name 				nvarchar2(20),
	qc_user_id 					varchar2(20),
	qc_user_name 				nvarchar2(20),
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table inbound add constraint pk_inbound primary key (row_id) using index;
comment on table inbound is '入库单';
comment on column inbound.row_id is 'uuid主键';
comment on column inbound.rdc_id is '物流中心';
comment on column inbound.receipt_id is '收货单';
comment on column inbound.print_count is '打印次数';
comment on column inbound.receiver_id is '收货人';
comment on column inbound.receiver_name is '收货人姓名';
comment on column inbound.qc_user_id is '质检人';
comment on column inbound.qc_user_name is '质检人姓名';
comment on column inbound.status is '状态';
comment on column inbound.udf1 is '用户自定义1';
comment on column inbound.udf2 is '用户自定义2';
comment on column inbound.udf3 is '用户自定义3';
comment on column inbound.add_id is '记录人';
comment on column inbound.add_name is '记录人姓名';
comment on column inbound.add_date is '记录时间';
comment on column inbound.edit_id is '编辑人';
comment on column inbound.edit_name is '编辑人姓名';
comment on column inbound.edit_date is '编辑时间';

create table inbound_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	inbound_row_id 				varchar2(32) not null,
	receipt_id 					varchar2(30) not null,
	line_id 					varchar2(30) not null,
	sku 						varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	lot 						varchar2(20) not null,
	qty 						number(22,5) not null,
	qty_received				number(22,5) default 0 not null,
	qty_rejected 				number(22,5) default 0 not null,
	uom 						varchar2(30) not null,
	pack_qty					number(22,5) default 1 not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table inbound_detail add constraint pk_inbound_detail primary key (row_id) using index;
create unique index uidx_inbound_detail on inbound_detail (rdc_id,receipt_id,line_id,inbound_row_id);
comment on table inbound_detail is '入库单明细';
comment on column inbound_detail.row_id is 'uuid主键';
comment on column inbound_detail.rdc_id is '物流中心';
comment on column inbound_detail.inbound_row_id is '入库单uuid主键';
comment on column inbound_detail.receipt_id is '收货单';
comment on column inbound_detail.line_id is '行号';
comment on column inbound_detail.sku is '货品';
comment on column inbound_detail.sku_descr is '货品描述';
comment on column inbound_detail.lot is '批次';
comment on column inbound_detail.qty is '计划数量';
comment on column inbound_detail.qty_received is '已接收数量';
comment on column inbound_detail.qty_rejected is '拒收数量';
comment on column inbound_detail.uom is '单位';
comment on column inbound_detail.pack_qty is '实际主包装含量';
comment on column inbound_detail.status is '状态';
comment on column inbound_detail.udf1 is '用户自定义1';
comment on column inbound_detail.udf2 is '用户自定义2';
comment on column inbound_detail.udf3 is '用户自定义3';
comment on column inbound_detail.add_id is '记录人';
comment on column inbound_detail.add_name is '记录人姓名';
comment on column inbound_detail.add_date is '记录时间';
comment on column inbound_detail.edit_id is '编辑人';
comment on column inbound_detail.edit_name is '编辑人姓名';
comment on column inbound_detail.edit_date is '编辑时间';

create table wave
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	owner_id 					varchar2(30),
	wave_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	outbound_date 				date not null,
 	delivery_route_id			varchar2(30),
	auto_allocate 				nvarchar2(1) default '否' not null,
  	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table wave add constraint pk_wave primary key (row_id) using index;
create unique index uidx_wave on wave (rdc_id,wave_id);
comment on table wave is '波次';
comment on column wave.row_id is 'uuid主键';
comment on column wave.rdc_id is '物流中心';
comment on column wave.owner_id is '货主';
comment on column wave.wave_id is '波次编码';
comment on column wave.descr is '波次描述';
comment on column wave.outbound_date is '出库时间';
comment on column wave.delivery_route_id is '配送路线';
comment on column wave.auto_allocate is '是否自动分配';
comment on column wave.status is '状态';
comment on column wave.udf1 is '用户自定义1';
comment on column wave.udf2 is '用户自定义2';
comment on column wave.udf3 is '用户自定义3';
comment on column wave.add_id is '记录人';
comment on column wave.add_name is '记录人姓名';
comment on column wave.add_date is '记录时间';
comment on column wave.edit_id is '编辑人';
comment on column wave.edit_name is '编辑人姓名';
comment on column wave.edit_date is '编辑时间';

create table wave_detail
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	wave_id 					varchar2(30) not null,
	order_id 					varchar2(30) not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table wave_detail add constraint pk_wave_detail primary key (row_id) using index;
create unique index uidx_wave_detail on wave_detail (rdc_id,wave_id,order_id);
comment on table wave_detail is '波次明细';
comment on column wave_detail.row_id is 'uuid主键';
comment on column wave_detail.rdc_id is '物流中心';
comment on column wave_detail.wave_id is '波次编码';
comment on column wave_detail.order_id is '订单号';
comment on column wave_detail.status is '状态';
comment on column wave_detail.udf1 is '用户自定义1';
comment on column wave_detail.udf2 is '用户自定义2';
comment on column wave_detail.udf3 is '用户自定义3';
comment on column wave_detail.add_id is '记录人';
comment on column wave_detail.add_name is '记录人姓名';
comment on column wave_detail.add_date is '记录时间';
comment on column wave_detail.edit_id is '编辑人';
comment on column wave_detail.edit_name is '编辑人姓名';
comment on column wave_detail.edit_date is '编辑时间';

create table wave_alloc_switch
(
	row_id						varchar2(32) not null,
	rdc_id	 					varchar2(30) not null,
	wave_id 					varchar2(30) not null,
	status 						varchar2(10) not null,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table wave_alloc_switch add constraint pk_wave_alloc_switch primary key (row_id) using index;
create unique index uidx_wave_alloc_switch on wave_alloc_switch (rdc_id);
comment on table wave_alloc_switch is '波次分配开关';
comment on column wave_alloc_switch.row_id is 'uuid主键';
comment on column wave_alloc_switch.rdc_id is '物流中心';
comment on column wave_alloc_switch.wave_id is '当前波次';
comment on column wave_alloc_switch.status is '波次状态';
comment on column wave_alloc_switch.edit_id is '编辑人';
comment on column wave_alloc_switch.edit_name is '编辑人姓名';
comment on column wave_alloc_switch.edit_date is '编辑时间';

create table orders
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	order_id 					varchar2(30) not null,
	type_id 	 				nvarchar2(30) not null,
	extern_order_id				varchar2(30) not null,
	created_date 				date not null,
	priority 					number default 0 not null,
	po_id 						varchar2(30),
	delivery_terms				varchar2(30),
	payment_terms				varchar2(30),
	customer_id 				varchar2(30) not null,
	customer_descr 				nvarchar2(60),
	customer_address 			nvarchar2(100),
	customer_city 		 		nvarchar2(60),
	customer_province 			nvarchar2(30),
  	customer_country			nvarchar2(50),
  	customer_zip_code  			varchar2(10),
	customer_contact1			nvarchar2(20),
	customer_phone1				varchar2(20),
	customer_contact2			nvarchar2(20),
	customer_phone2				varchar2(20),
	customer_email				varchar2(30),
	customer_fax				varchar2(20),
	buyer_id 					varchar2(30),
	buyer_descr 				nvarchar2(60),
	buyer_type 					varchar2(30),
	buyer_amount 				number(22,5),
	buyer_address 				nvarchar2(100),
	buyer_city 		 			nvarchar2(60),
	buyer_province 				nvarchar2(30),
  	buyer_country				nvarchar2(50),
  	buyer_zip_code  			varchar2(10),
	buyer_contact1				nvarchar2(20),
	buyer_phone1				varchar2(20),
	buyer_contact2				nvarchar2(20),
	buyer_phone2				varchar2(20),
	buyer_email					varchar2(30),
	buyer_fax					varchar2(20),
	wave_id  					varchar2(30),
	allow_consolidation 		nvarchar2(1) default '否' not null,
	delivery_route_id			varchar2(30),
	stop 						varchar2(20),
	carrier_id					varchar2(30),
	carrier_descr 				nvarchar2(60),
	carrier_type 				varchar2(30),
	carrier_address 			nvarchar2(100),
	carrier_city 		 		nvarchar2(60),
	carrier_province 			nvarchar2(30),
  	carrier_country				nvarchar2(50),
  	carrier_zip_code  			varchar2(10),
	carrier_contact1			nvarchar2(20),
	carrier_phone1				varchar2(20),
	carrier_contact2			nvarchar2(20),
	carrier_phone2				varchar2(20),
	carrier_email				varchar2(30),
	carrier_fax					varchar2(20),
	transport_mode				varchar2(30),
	car_number 					varchar2(30),
	driver_name					nvarchar2(20),
	freight_charge 				number(22,5),
	warehouse_id				varchar2(30),
	region_id					varchar2(30),
	dock_id 					varchar2(30),
	delivery_date               date,
	actual_delivery_date 		date,
	qty 						number(22,5),
	cube 						number(22,5),
	gross_weight 				number(22,5),
	net_weight 					number(22,5),
	loc_id 						varchar2(30),
	print_count 				number default 0 not null,
	intercept 					nvarchar2(1) default '否' not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table orders add constraint pk_orders primary key (row_id) using index;
create unique index uidx_orders on orders (rdc_id,order_id);
comment on table orders is '出库订单';
comment on column orders.row_id is 'uuid主键';
comment on column orders.rdc_id is '物流中心';
comment on column orders.owner_id is '货主';
comment on column orders.order_id is '订单号';
comment on column orders.type_id is '单据类型';
comment on column orders.extern_order_id is '外部单号';
comment on column orders.created_date is '单据创建时间';
comment on column orders.priority is '优先级';
comment on column orders.po_id is 'PO单号';
comment on column orders.delivery_terms is '交货条款';
comment on column orders.payment_terms is '付款条款';
comment on column orders.customer_id is '客户';
comment on column orders.customer_descr is '客户描述';
comment on column orders.customer_address is '客户地址';
comment on column orders.customer_city is '客户城市';
comment on column orders.customer_province is '客户省份';
comment on column orders.customer_country is '客户国家';
comment on column orders.customer_zip_code is '客户邮编';
comment on column orders.customer_contact1 is '客户联系人1';
comment on column orders.customer_phone1 is '客户电话1';
comment on column orders.customer_contact2 is '客户联系人2';
comment on column orders.customer_phone2 is '客户电话2';
comment on column orders.customer_email is '客户邮箱';
comment on column orders.customer_fax is '客户传真';
comment on column orders.buyer_id is '付款方';
comment on column orders.buyer_descr is '付款方描述';
comment on column orders.buyer_type is '付款方类型';
comment on column orders.buyer_amount is '付款金额';
comment on column orders.buyer_address is '付款方地址';
comment on column orders.buyer_city is '付款方城市';
comment on column orders.buyer_province is '付款方省份';
comment on column orders.buyer_country is '付款方国家';
comment on column orders.buyer_zip_code is '付款方邮编';
comment on column orders.buyer_contact1 is '付款方联系人1';
comment on column orders.buyer_phone1 is '付款方电话1';
comment on column orders.buyer_contact2 is '付款方联系人2';
comment on column orders.buyer_phone2 is '付款方电话2';
comment on column orders.buyer_email is '付款方邮箱';
comment on column orders.buyer_fax is '付款方传真';
comment on column orders.wave_id is '波次';
comment on column orders.allow_consolidation is '是否允许合并拣货';
comment on column orders.delivery_route_id is '配送路线';
comment on column orders.stop is '配送路序';
comment on column orders.carrier_id is '承运商';
comment on column orders.carrier_descr is '承运商描述';
comment on column orders.carrier_type is '承运商类型';
comment on column orders.carrier_address is '承运商地址';
comment on column orders.carrier_city is '承运商城市';
comment on column orders.carrier_province is '承运商省份';
comment on column orders.carrier_country is '承运商国家';
comment on column orders.carrier_zip_code is '承运商邮编';
comment on column orders.carrier_contact1 is '承运商联系人1';
comment on column orders.carrier_phone1 is '承运商电话1';
comment on column orders.carrier_contact2 is '承运商联系人2';
comment on column orders.carrier_phone2 is '承运商电话2';
comment on column orders.carrier_email is '承运商邮箱';
comment on column orders.carrier_fax is '承运商传真';
comment on column orders.transport_mode is '运输方式';
comment on column orders.car_number is '车牌号';
comment on column orders.driver_name is '司机';
comment on column orders.freight_charge is '运费';
comment on column orders.warehouse_id is '发货仓库';
comment on column orders.region_id is '发货区域';
comment on column orders.dock_id is '发货月台';
comment on column orders.delivery_date is '发货时间';
comment on column orders.actual_delivery_date is '实际发货时间';
comment on column orders.qty is '单据总数量';
comment on column orders.cube is '单据总体积';
comment on column orders.gross_weight is '单据总毛重';
comment on column orders.net_weight is '单据总净重';
comment on column orders.loc_id is '集货区库位编码';
comment on column orders.print_count is '打印次数';
comment on column orders.intercept is '是否拦截';
comment on column orders.status is '状态';
comment on column orders.udf1 is '用户自定义1';
comment on column orders.udf2 is '用户自定义2';
comment on column orders.udf3 is '用户自定义3';
comment on column orders.udf4 is '用户自定义4';
comment on column orders.udf5 is '用户自定义5';
comment on column orders.notes is '备注';
comment on column orders.add_id is '记录人';
comment on column orders.add_name is '记录人姓名';
comment on column orders.add_date is '记录时间';
comment on column orders.edit_id is '编辑人';
comment on column orders.edit_name is '编辑人姓名';
comment on column orders.edit_date is '编辑时间';

create table orders_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	order_id					varchar2(30) not null,
	line_id						varchar2(30) not null,
	extern_id 					varchar2(30) not null,
	extern_line_id 				varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	qty_original 				number(22,5) not null,
	qty 						number(22,5) not null,
	qty_allocated				number(22,5) default 0 not null,
	qty_picked					number(22,5) default 0 not null,
	qty_shipped 				number(22,5) default 0 not null,
	uom 						varchar2(30) not null,
	pack_id						varchar2(30) not null,
	lot							varchar2(20),
	warehouse_id				varchar2(30),
	loc_group_id				varchar2(30),
	loc_id 						varchar2(30),
	container_id 				varchar2(30),
	lot01 						varchar2(30),
	lot02 						varchar2(30),
	lot03 						varchar2(30),
	lot04 						varchar2(30),
	lot05 						varchar2(30),
	lot06 						varchar2(30),
	lot07 						varchar2(30),
	lot08 						varchar2(30),
	lot09 						varchar2(30),
	lot10 						varchar2(30),
	lot11 						varchar2(30),
	lot12 						varchar2(30),
	lot13 						varchar2(30),
	lot14 						varchar2(30),
	lot15 						date,
	lot16 						date,
	lot17 						date,
	lot18 						date,
	lot19 						date,
	lot20 						date,
	priority					number default 0 not null, 
	allocate_strategy_id        varchar2(30) not null,
	rotation_id  				varchar2(20),
	cube 						number(22,5),
	gross_weight 				number(22,5),
	net_weight 					number(22,5),
	actual_delivery_date 		date,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table orders_detail add constraint pk_orders_detail primary key (row_id) using index;
create unique index uidx_orders_detail on orders_detail (rdc_id,order_id,line_id);
comment on table orders_detail is '出库订单明细';
comment on column orders_detail.row_id is 'uuid主键';
comment on column orders_detail.rdc_id	is '物流中心';
comment on column orders_detail.owner_id is '货主';
comment on column orders_detail.order_id is '订单号';
comment on column orders_detail.line_id is '行号';
comment on column orders_detail.extern_id is '外部单号';
comment on column orders_detail.extern_line_id is '外部行号';
comment on column orders_detail.sku is '货品';
comment on column orders_detail.sku_descr is '货品描述';
comment on column orders_detail.qty_original is '原始单据数量';
comment on column orders_detail.qty is '出库数量';
comment on column orders_detail.qty_allocated is '分配量';
comment on column orders_detail.qty_picked is '拣货量';
comment on column orders_detail.qty_shipped is '发货量';
comment on column orders_detail.uom is '单位';
comment on column orders_detail.pack_id is '包装编码';
comment on column orders_detail.lot is '指定批次';
comment on column orders_detail.warehouse_id is '指定仓库';
comment on column orders_detail.loc_group_id is '指定库位组';
comment on column orders_detail.loc_id is '指定库位';
comment on column orders_detail.container_id is '指定容器';
comment on column orders_detail.lot01 is '批属性01';
comment on column orders_detail.lot02 is '批属性02';
comment on column orders_detail.lot03 is '批属性03';
comment on column orders_detail.lot04 is '批属性04';
comment on column orders_detail.lot05 is '批属性05';
comment on column orders_detail.lot06 is '批属性06';
comment on column orders_detail.lot07 is '批属性07';
comment on column orders_detail.lot08 is '批属性08';
comment on column orders_detail.lot09 is '批属性09';
comment on column orders_detail.lot10 is '批属性10';
comment on column orders_detail.lot11 is '批属性11';
comment on column orders_detail.lot12 is '批属性12';
comment on column orders_detail.lot13 is '批属性13';
comment on column orders_detail.lot14 is '批属性14';
comment on column orders_detail.lot15 is '批属性15';
comment on column orders_detail.lot16 is '批属性16';
comment on column orders_detail.lot17 is '批属性17';
comment on column orders_detail.lot18 is '批属性18';
comment on column orders_detail.lot19 is '批属性19';
comment on column orders_detail.lot20 is '批属性20';
comment on column orders_detail.priority is '优先级';
comment on column orders_detail.allocate_strategy_id is '分配策略';
comment on column orders_detail.rotation_id is '库存周转';
comment on column orders_detail.cube is '体积';
comment on column orders_detail.gross_weight is '毛重';
comment on column orders_detail.net_weight is '净重';
comment on column orders_detail.actual_delivery_date is '实际发货时间';
comment on column orders_detail.status is '状态';
comment on column orders_detail.udf1 is '用户自定义1';
comment on column orders_detail.udf2 is '用户自定义2';
comment on column orders_detail.udf3 is '用户自定义3';
comment on column orders_detail.udf4 is '用户自定义4';
comment on column orders_detail.udf5 is '用户自定义5';
comment on column orders_detail.notes is '备注';
comment on column orders_detail.add_id is '记录人';
comment on column orders_detail.add_name is '记录人姓名';
comment on column orders_detail.add_date is '记录时间';
comment on column orders_detail.edit_id is '编辑人';
comment on column orders_detail.edit_name is '编辑人姓名';
comment on column orders_detail.edit_date is '编辑时间';

create table lpn_document
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	receipt_group_id 			varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	owner_id      	 			varchar2(30),
	vendor_id 					varchar2(30),
	lpn 						varchar2(30) not null,
	container_id				varchar2(30) default ' ' not null,
	sku 						varchar2(30),
	sku_descr 					nvarchar2(60),
	uom 						varchar2(30) not null,
	pack_id						varchar2(30),
	pack_qty					number(22,5),
	packs 						number(22,5),
	qty 						number(22,5),
	actual_qty 					number(22,5),
	lot01 						varchar2(30),
	lot02 						varchar2(30),
	lot03 						varchar2(30),
	lot04 						varchar2(30),
	lot05 						varchar2(30),
	lot06 						varchar2(30),
	lot07 						varchar2(30),
	lot08 						varchar2(30),
	lot09 						varchar2(30),
	lot10 						varchar2(30),
	lot11 						varchar2(30),
	lot12 						varchar2(30),
	lot13 						varchar2(30),
	lot14 						varchar2(30),
	lot15 						date,
	lot16 						date,
	lot17 						date,
	lot18 						date,
	lot19 						date,
	lot20 						date,
	receiver_id					varchar2(20),
	receiver_name				varchar2(20),
	checker_id					varchar2(20),
	checker_name				nvarchar2(20),
	print_count       			number default 0 not null,
	related_row_id				varchar2(32),
	related_detail_row_id		varchar2(32),
	sorter_sequence 			number default 0 not null,
	wave_id 					varchar2(30),
	sorter_id 					varchar2(30),
	source        				nvarchar2(20) not null,
	shipping_area_loc_id 		varchar2(30),
	delivery_route_id			varchar2(30) not null,
	customer_id		  			varchar2(30),
	customer_descr				nvarchar2(60),
	equipment_type 				nvarchar2(20) not null,
    distributionflag			VARCHAR2(2) default 'N' not null,
    current_box_number			number default 0 not null,
    status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date,
	labeler_id 					varchar2(20),
	labeler_name				nvarchar2(20),
	labeler_date				date,
	offline_date				date,
	loader_id 					varchar2(20),
	loader_name					nvarchar2(20),
	loader_date					date,
	floor						nvarchar2(20)
);
alter table lpn_document add constraint pk_lpn_document primary key (row_id) using index;
create unique index uidx_lpn_document on lpn_document (rdc_id,lpn);
comment on table lpn_document is '标签主档';
comment on column lpn_document.row_id is 'uuid主键';
comment on column lpn_document.rdc_id is '物流中心';
comment on column lpn_document.receipt_group_id is '收货分组号';
comment on column lpn_document.warehouse_id is '仓库';
comment on column lpn_document.owner_id is '货主';
comment on column lpn_document.vendor_id is '供应商';
comment on column lpn_document.lpn is 'LPN';
comment on column lpn_document.container_id is '容器';
comment on column lpn_document.sku is '货品';
comment on column lpn_document.sku_descr is '货品描述';
comment on column lpn_document.uom is '单位';
comment on column lpn_document.pack_id is '包装编码';
comment on column lpn_document.pack_qty is '实际主包装含量';
comment on column lpn_document.packs is '包装数量';
comment on column lpn_document.qty is '计划数量';
comment on column lpn_document.actual_qty is '实际数量';
comment on column lpn_document.lot01 is '批属性01';
comment on column lpn_document.lot02 is '批属性02';
comment on column lpn_document.lot03 is '批属性03';
comment on column lpn_document.lot04 is '批属性04';
comment on column lpn_document.lot05 is '批属性05';
comment on column lpn_document.lot06 is '批属性06';
comment on column lpn_document.lot07 is '批属性07';
comment on column lpn_document.lot08 is '批属性08';
comment on column lpn_document.lot09 is '批属性09';
comment on column lpn_document.lot10 is '批属性10';
comment on column lpn_document.lot11 is '批属性11';
comment on column lpn_document.lot12 is '批属性12';
comment on column lpn_document.lot13 is '批属性13';
comment on column lpn_document.lot14 is '批属性14';
comment on column lpn_document.lot15 is '批属性15';
comment on column lpn_document.lot16 is '批属性16';
comment on column lpn_document.lot17 is '批属性17';
comment on column lpn_document.lot18 is '批属性18';
comment on column lpn_document.lot19 is '批属性19';
comment on column lpn_document.lot20 is '批属性20';
comment on column lpn_document.receiver_id is '收货人';
comment on column lpn_document.receiver_name is '收货人姓名';
comment on column lpn_document.checker_id is '复核人';
comment on column lpn_document.checker_name is '复核人姓名';
comment on column lpn_document.print_count is '打印次数';
comment on column lpn_document.related_row_id is '关联表的row_id';
comment on column lpn_document.related_detail_row_id is '关联明细表的row_id';
comment on column lpn_document.sorter_sequence is '分拣线下线顺序';
comment on column lpn_document.wave_id is '波次';
comment on column lpn_document.sorter_id is '分拣口';
comment on column lpn_document.source is '来源:合并拣货/按单拣货/件拣货/补货/越库';
comment on column lpn_document.shipping_area_loc_id is '集货区';
comment on column lpn_document.delivery_route_id is '路线';
comment on column lpn_document.customer_id is '客户';
comment on column lpn_document.customer_descr is '客户描述';
comment on column lpn_document.equipment_type is '设备类型';
comment on column lpn_document.distributionflag is '是否已经将箱码下发给输送线接口(贴标机)';
comment on column lpn_document.current_box_number is '序号';
comment on column lpn_document.status is '状态:00初始状态/10拣货完成/15复核完成/20贴标完成/25已下线/30装载完成/40停用/45上架中/50上架完成';
comment on column lpn_document.udf1 is '用户自定义1';
comment on column lpn_document.udf2 is '用户自定义2';
comment on column lpn_document.udf3 is '用户自定义3';
comment on column lpn_document.udf4 is '用户自定义4';
comment on column lpn_document.udf5 is '用户自定义5';
comment on column lpn_document.notes is '备注';
comment on column lpn_document.add_id is '记录人';
comment on column lpn_document.add_name is '记录人姓名';
comment on column lpn_document.add_date is '记录时间';
comment on column lpn_document.edit_id is '编辑人';
comment on column lpn_document.edit_name is '编辑人姓名';
comment on column lpn_document.edit_date is '编辑时间';
comment on column lpn_document.labeler_id is '贴标人';
comment on column lpn_document.labeler_name is '贴标人姓名';
comment on column lpn_document.labeler_date is '贴标时间';
comment on column lpn_document.offline_date is '下线时间';
comment on column lpn_document.loader_id is '装载人';
comment on column lpn_document.loader_name is '装载人姓名';
comment on column lpn_document.loader_date is '装载时间';
comment on column lpn_document.floor is '楼层';

create table task_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id 				varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	wave_id 					varchar2(30) not null,
	order_id					varchar2(30) not null,
	line_id						varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	customer_id 				varchar2(30) not null,
	area_id 					varchar2(30) not null,
	loc_group_id				varchar2(30) not null,
	loc_id 						varchar2(30) not null,
	pick_logical				varchar2(30) not null,
	lot 						varchar2(20) not null,
	container_id 				varchar2(30) not null,
	xy_loc 						varchar2(30),
	group_id 					varchar2(30),
	task_id 					varchar2(30),
	pick_lpn 					varchar2(30),
	equipment_type				nvarchar2(20) not null,
	pack_id						varchar2(30) not null,
	pack_qty					number(22,5) not null,
	qty 						number(22,5) not null,
	qty_picked 					number(22,5) not null,
	packs 						number(22,5) not null,
	packs_picked 				number(22,5) not null,
	allow_consolidation			nvarchar2(1) default '否' not null,
	consolidation_row_id        varchar2(32),
	pick_to       				varchar2(30) not null,
  	task_type 					nvarchar2(10) not null,
  	occupant_id					varchar2(20),
  	occupant_name				nvarchar2(20),
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	inventory_row_id			varchar2(32)
);
alter table task_detail add constraint pk_task_detail primary key (row_id) using index;
comment on table task_detail is '任务明细';
comment on column task_detail.row_id is 'uuid主键';
comment on column task_detail.rdc_id is '物流中心';
comment on column task_detail.warehouse_id is '仓库';
comment on column task_detail.owner_id is '货主';
comment on column task_detail.wave_id is '波次';
comment on column task_detail.order_id is '订单号';
comment on column task_detail.line_id is '行号';
comment on column task_detail.sku is '货品';
comment on column task_detail.sku_descr is '货品描述';
comment on column task_detail.customer_id is '客户';
comment on column task_detail.area_id is '库区';
comment on column task_detail.loc_group_id is '库位组:电子标签的区段可以使用';
comment on column task_detail.loc_id is '库位';
comment on column task_detail.pick_logical is '拣货路线';
comment on column task_detail.lot is '批次';
comment on column task_detail.container_id is '容器';
comment on column task_detail.xy_loc is '组车拣货时拣货容器位置';
comment on column task_detail.group_id is '任务组号、预派箱号';
comment on column task_detail.task_id is '任务顺序号';
comment on column task_detail.pick_lpn is '实际拣货容器';
comment on column task_detail.equipment_type is '作业设备';
comment on column task_detail.pack_id is '包装编码';
comment on column task_detail.pack_qty is '实际主包装含量';
comment on column task_detail.qty is '拣货量';
comment on column task_detail.qty_picked is '已拣数量';
comment on column task_detail.packs is '包装数量';
comment on column task_detail.packs_picked is '已拣包装数量';
comment on column task_detail.allow_consolidation is '是否允许合并拣货';
comment on column task_detail.consolidation_row_id is '合并任务明细uuid';
comment on column task_detail.pick_to is '拣货到库位';
comment on column task_detail.task_type is '任务类型:合并拣货/按单拣货/件拣货/电子标签/其他';
comment on column task_detail.occupant_id is '占用人';
comment on column task_detail.occupant_name is '占用人姓名';
comment on column task_detail.status is '状态:00初始状态/05合并拣货已汇总/10已占用/20拣货中/30拣货完成';
comment on column task_detail.udf1 is '用户自定义1';
comment on column task_detail.udf2 is '用户自定义2';
comment on column task_detail.udf3 is '用户自定义3';
comment on column task_detail.udf4 is '用户自定义4';
comment on column task_detail.udf5 is '用户自定义5';
comment on column task_detail.add_id is '记录人';
comment on column task_detail.add_name is '记录人姓名';
comment on column task_detail.add_date is '记录时间';
comment on column task_detail.inventory_row_id is '库存uuid';

create table task_consolidation_detail
(
	row_id						varchar2(32) not null,
  	rdc_id						varchar2(30) not null,
	warehouse_id 				varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	area_id 					varchar2(30) not null,
	loc_group_id				varchar2(30) not null,
	loc_id 						varchar2(30) not null,
	pick_logical				varchar2(30) not null,
	lot 						varchar2(20) not null,
	container_id 				varchar2(30) not null,
	customer_count 				number not null,
	group_id 					varchar2(30),
	task_id 					varchar2(30),
	equipment_type				nvarchar2(20) not null,
	pack_id						varchar2(30) not null,
	pack_qty					number(22,5) not null,
	qty 						number(22,5) not null,
	qty_picked 					number(22,5) not null,
	packs 						number(22,5) not null,
	packs_picked 				number(22,5) not null,
	pick_to       				varchar2(30) not null,
    distributionflag			VARCHAR2(2) default 'N' not null,
    occupant_id					varchar2(20),
    occupant_name				nvarchar2(20),
    pick_lpn					varchar2(30),
    wave_id 					varchar2(30) not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	inventory_row_id			varchar2(32)
);
alter table task_consolidation_detail add constraint pk_task_consolidation_detail primary key (row_id) using index;
comment on table task_consolidation_detail is '合并任务明细';
comment on column task_consolidation_detail.row_id is 'uuid主键';
comment on column task_consolidation_detail.rdc_id is '物流中心';
comment on column task_consolidation_detail.warehouse_id is '仓库';
comment on column task_consolidation_detail.owner_id is '货主';
comment on column task_consolidation_detail.sku is '货品';
comment on column task_consolidation_detail.sku_descr is '货品描述';
comment on column task_consolidation_detail.area_id is '库区';
comment on column task_consolidation_detail.loc_group_id is '库位组:电子标签的区段可以使用';
comment on column task_consolidation_detail.loc_id is '库位';
comment on column task_consolidation_detail.pick_logical is '拣货路线';
comment on column task_consolidation_detail.lot is '批次';
comment on column task_consolidation_detail.container_id is '容器';
comment on column task_consolidation_detail.customer_count is '客户数量';
comment on column task_consolidation_detail.group_id is '任务组';
comment on column task_consolidation_detail.task_id is '任务顺序号';
comment on column task_consolidation_detail.equipment_type is '作业设备';
comment on column task_consolidation_detail.pack_id is '包装编码';
comment on column task_consolidation_detail.pack_qty is '实际主包装含量';
comment on column task_consolidation_detail.qty is '拣货量';
comment on column task_consolidation_detail.qty_picked is '已拣数量';
comment on column task_consolidation_detail.packs is '包装数量';
comment on column task_consolidation_detail.packs_picked is '已拣包装数量';
comment on column task_consolidation_detail.pick_to is '拣货到库位';
comment on column task_consolidation_detail.distributionflag is '是否将出库任务下发给拆垛机';
comment on column task_consolidation_detail.occupant_id is '占用人';
comment on column task_consolidation_detail.occupant_name is '占用人姓名';
comment on column task_consolidation_detail.pick_lpn is '拣货容器';
comment on column task_consolidation_detail.wave_id is '波次';
comment on column task_consolidation_detail.status is '状态:00初始状态/10已占用/20拣货中/25拣货异常/30拣货完成';
comment on column task_consolidation_detail.udf1 is '用户自定义1';
comment on column task_consolidation_detail.udf2 is '用户自定义2';
comment on column task_consolidation_detail.udf3 is '用户自定义3';
comment on column task_consolidation_detail.udf4 is '用户自定义4';
comment on column task_consolidation_detail.udf5 is '用户自定义5';
comment on column task_consolidation_detail.add_id is '记录人';
comment on column task_consolidation_detail.add_name is '记录人姓名';
comment on column task_consolidation_detail.add_date is '记录时间';
comment on column task_consolidation_detail.inventory_row_id is '库存uuid';

--合并拣货时，拣货过程生成到该表，分播时也生成到该表
create table pick_detail
(
	row_id						varchar2(32) not null,
	task_row_id					varchar2(32) not null,
	task_type					nvarchar2(10) not null,
	lpn 						varchar2(30),
	pack_qty					number(22,5) not null,
	qty_picked 					number(22,5) not null,
	packs_picked 				number(22,5) not null,
	pick_lpn      				varchar2(30),
	qty_checked 				number(22,5) not null,
	packs_checked 				number(22,5) not null,
	delivery_route_id			varchar2(30),
	stop 						varchar2(20),
	print_count 				number default 0 not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	rdc_id						varchar2(30) not null,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date,
	checker_id 					varchar2(20),
	checker_name				nvarchar2(20),
	checker_date				date,
	canceler_id 				varchar2(20),
	canceler_name				nvarchar2(20),
	canceler_date				date,
	occupant_id					varchar2(20),
  	occupant_name				nvarchar2(20),
  	client_type 				varchar2(2),
  	release_id					varchar2(20),
  	release_name				nvarchar2(20),
  	group_id 					varchar2(30)
);
alter table pick_detail add constraint pk_pick_detail primary key (row_id) using index;
create index idx_pick_detail_t on pick_detail (task_row_id);
comment on table pick_detail is '拣货明细';
comment on column pick_detail.row_id is 'uuid主键';
comment on column pick_detail.task_row_id is '任务uuid';
comment on column pick_detail.task_type is '任务类型:合并拣货/按单拣货/件拣货/货品分拨/电子标签/其他';
comment on column pick_detail.lpn is '标签拣货时的标签';
comment on column pick_detail.pack_qty is '实际主包装含量';
comment on column pick_detail.qty_picked is '已拣数量';
comment on column pick_detail.packs_picked is '已拣包装数量';
comment on column pick_detail.pick_lpn is '拣货容器';
comment on column pick_detail.qty_checked is '已复核数量';
comment on column pick_detail.packs_checked is '已复核包装数量';
comment on column pick_detail.delivery_route_id is '配送路线';
comment on column pick_detail.stop is '配送路序';
comment on column pick_detail.print_count is '打印次数';
comment on column pick_detail.status is '状态:00初始状态/10拣货完成/20合并拣货已分拨/30复核中/40复核完成/50装载中/60装载完成';
comment on column pick_detail.udf1 is '用户自定义1';
comment on column pick_detail.udf2 is '用户自定义2';
comment on column pick_detail.udf3 is '用户自定义3';
comment on column pick_detail.add_id is '记录人';
comment on column pick_detail.add_name is '记录人姓名';
comment on column pick_detail.add_date is '记录时间';
comment on column pick_detail.rdc_id is '物流中心';
comment on column pick_detail.edit_id is '编辑人';
comment on column pick_detail.edit_name is '编辑人姓名';
comment on column pick_detail.edit_date is '编辑时间';
comment on column pick_detail.checker_id is '复核人';
comment on column pick_detail.checker_name is '复核人姓名';
comment on column pick_detail.checker_date is '复核时间';
comment on column pick_detail.canceler_id is '删除人';
comment on column pick_detail.canceler_name is '删除人姓名';
comment on column pick_detail.canceler_date is '删除时间';
comment on column pick_detail.occupant_id is '占用人';
comment on column pick_detail.occupant_name is '占用人姓名';
comment on column pick_detail.client_type is '客户端类型:PC/RF';
comment on column pick_detail.release_id is '释放人';
comment on column pick_detail.release_name is '释放人姓名';
comment on column pick_detail.group_id is '任务组号';

--暂时不使用，废弃
--group_row_id为每次复核生成的关联组号，例如拣货明细两条，数量5，数量10，可能是一次性复核15个，此时该表两条记录，
--group_row_id一样
create table check_detail
(
	row_id						varchar2(32) not null,
	task_row_id					varchar2(32) not null,
	pick_row_id					varchar2(32) not null,
	group_row_id				varchar2(32) not null,
	pack_qty					number(22,5) not null,
	qty_checked 				number(22,5) not null,
	packs_checked 				number(22,5) not null,
	pick_lpn      				varchar2(30),
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table check_detail add constraint pk_check_detail primary key (row_id) using index;
create index idx_check_detail_t on check_detail (task_row_id);
create index idx_check_detail_p on check_detail (pick_row_id);
create index idx_check_detail_g on check_detail (group_row_id);
comment on table check_detail is '复核明细';
comment on column check_detail.row_id is 'uuid主键';
comment on column check_detail.task_row_id is '任务uuid';
comment on column check_detail.pick_row_id is '拣货uuid';
comment on column check_detail.group_row_id is '复核组uuid';
comment on column check_detail.pack_qty is '实际主包装含量';
comment on column check_detail.qty_checked is '复核量';
comment on column check_detail.packs_checked is '已复核包装数量';
comment on column check_detail.pick_lpn is '拣货容器';
comment on column check_detail.status is '状态';
comment on column check_detail.udf1 is '用户自定义1';
comment on column check_detail.udf2 is '用户自定义2';
comment on column check_detail.udf3 is '用户自定义3';
comment on column check_detail.add_id is '记录人';
comment on column check_detail.add_name is '记录人姓名';
comment on column check_detail.add_date is '记录时间';

create table load_detail
(
	row_id						varchar2(32) not null,
	check_row_id				varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id 				varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	wave_id 					varchar2(30) not null,
	order_id					varchar2(30) not null,
	extern_order_id 			varchar2(30),
	line_id						varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	customer_id 				varchar2(30) not null,
	lot 						varchar2(20) not null,
	area_id 					varchar2(30) not null,
	loc_id 						varchar2(30) not null,
	container_id 				varchar2(30) not null,
	pick_lpn      				varchar2(30),
	load_lpn      				varchar2(30),
	qty_checked 				number(22,5) not null,
	qty 						number(22,5) not null,
	pack_qty					number(22,5) not null,
	packs 						number(22,5) not null,
	source 						nvarchar2(20) not null,
	transport_id 				varchar2(30),
	pick_to       				varchar2(30),
	shipped_date 				date,
	cube						number(22,5) default 0 not null,
	weight 						number(22,5) default 0 not null,
  	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table load_detail add constraint pk_load_detail primary key (row_id) using index;
create index idx_load_detail_c on load_detail (check_row_id);
comment on table load_detail is '装载明细';
comment on column load_detail.row_id is 'uuid主键';
comment on column load_detail.check_row_id is '复核uuid';
comment on column load_detail.rdc_id is '物流中心';
comment on column load_detail.warehouse_id is '仓库';
comment on column load_detail.owner_id is '货主';
comment on column load_detail.wave_id is '波次';
comment on column load_detail.order_id is '订单号';
comment on column load_detail.extern_order_id is '外部单号';
comment on column load_detail.line_id is '行号';
comment on column load_detail.sku is '货品';
comment on column load_detail.sku_descr is '货品描述';
comment on column load_detail.customer_id is '客户';
comment on column load_detail.lot is '批次';
comment on column load_detail.area_id is '库区';
comment on column load_detail.loc_id is '库位';
comment on column load_detail.container_id is '容器';
comment on column load_detail.pick_lpn is '拣货容器';
comment on column load_detail.load_lpn is '装载容器';
comment on column load_detail.qty_checked is '已复核数量';
comment on column load_detail.qty is '装载数量';
comment on column load_detail.pack_qty is '实际主包装含量';
comment on column load_detail.packs is '包装数量';
comment on column load_detail.source is '来源:按单拣货/件拣货/货品分拨';
comment on column load_detail.transport_id is '运输单号';
comment on column load_detail.pick_to is '拣货到库位';
comment on column load_detail.shipped_date is '发货时间';
comment on column load_detail.cube is '体积';
comment on column load_detail.weight is '重量';
comment on column load_detail.status is '状态:00初始状态/10已复核/30已装载/40已集货/50已装车';
comment on column load_detail.udf1 is '用户自定义1';
comment on column load_detail.udf2 is '用户自定义2';
comment on column load_detail.udf3 is '用户自定义3';
comment on column load_detail.udf4 is '用户自定义4';
comment on column load_detail.udf5 is '用户自定义5';
comment on column load_detail.add_id is '记录人';
comment on column load_detail.add_name is '记录人姓名';
comment on column load_detail.add_date is '记录时间';
comment on column load_detail.edit_id is '编辑人';
comment on column load_detail.edit_name is '编辑人姓名';
comment on column load_detail.edit_date is '编辑时间';

create table transport
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	transport_id 				varchar2(30) not null,
	delivery_route_id 			varchar2(30) not null,
	vehicle_number  			varchar2(20),
	driver_name					nvarchar2(20),
	print_count 				number default 0 not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	shipped_user_id 			varchar2(20),
	shipped_user_name 			nvarchar2(20),
	shipped_date 				date
);
alter table transport add constraint pk_transport primary key (row_id) using index;
create unique index uidx_transport on transport (rdc_id,transport_id);
comment on table transport is '派车信息';
comment on column transport.row_id is 'uuid主键';
comment on column transport.rdc_id is '物流中心';
comment on column transport.transport_id is '运输单号';
comment on column transport.delivery_route_id is '配送路线';
comment on column transport.vehicle_number is '车牌号';
comment on column transport.driver_name is '司机';
comment on column transport.print_count is '打印次数';
comment on column transport.status is '状态';
comment on column transport.udf1 is '用户自定义1';
comment on column transport.udf2 is '用户自定义2';
comment on column transport.udf3 is '用户自定义3';
comment on column transport.add_id is '记录人';
comment on column transport.add_name is '记录人姓名';
comment on column transport.add_date is '记录时间';
comment on column transport.shipped_user_id is '发货人';
comment on column transport.shipped_user_name is '发货人姓名';
comment on column transport.shipped_date is '发货时间';

create table transport_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	transport_id 				varchar2(30) not null,
	load_lpn      				varchar2(30) not null,
	total_qty 					number(22,5) default 0 not null,
	total_cube					number(22,5) default 0 not null,
	total_weight 				number(22,5) default 0 not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table transport_detail add constraint pk_transport_detail primary key (row_id) using index;
create unique index uidx_transport_detail on transport_detail (rdc_id,transport_id,load_lpn);
comment on table transport_detail is '派车装载客户';
comment on column transport_detail.row_id is 'uuid主键';
comment on column transport_detail.rdc_id is '物流中心';
comment on column transport_detail.transport_id is '运输单号';
comment on column transport_detail.load_lpn is '装载容器';
comment on column transport_detail.total_qty is '总数量';
comment on column transport_detail.total_cube is '总体积';
comment on column transport_detail.total_weight is '总重量';
comment on column transport_detail.status is '状态';
comment on column transport_detail.udf1 is '用户自定义1';
comment on column transport_detail.udf2 is '用户自定义2';
comment on column transport_detail.udf3 is '用户自定义3';
comment on column transport_detail.add_id is '记录人';
comment on column transport_detail.add_name is '记录人姓名';
comment on column transport_detail.add_date is '记录时间';

create table merge_log
(
	row_id						varchar2(32) not null,
	pick_row_id					varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	wave_id 					varchar2(30) not null,
	order_id					varchar2(30) not null,
	customer_id 				varchar2(30) not null,
	line_id						varchar2(30) not null,
	lot 						varchar2(20) not null,
	owner_id       				varchar2(30) not null,
	sku       					varchar2(30) not null,
	loc_id 						varchar2(30) not null,
 	container_id 				varchar2(30) not null,
	qty 						number(22,5) not null,
	packs 		 				number(22,5) not null,
	from_lpn 					varchar2(30) not null,
	to_lpn 						varchar2(30) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table merge_log add constraint pk_merge_log primary key (row_id) using index;
create index idx_merge_log_p on merge_log (pick_row_id);
comment on table merge_log is '合箱日志';
comment on column merge_log.row_id is 'uuid主键';
comment on column merge_log.pick_row_id is '拣货明细uuid';
comment on column merge_log.rdc_id is '物流中心';
comment on column merge_log.warehouse_id is '仓库';
comment on column merge_log.wave_id is '波次';
comment on column merge_log.order_id is '订单号';
comment on column merge_log.customer_id is '客户';
comment on column merge_log.line_id is '行号';
comment on column merge_log.lot is '批次';
comment on column merge_log.owner_id is '货主';
comment on column merge_log.sku is '货品';
comment on column merge_log.loc_id is '库位';
comment on column merge_log.container_id is '容器';
comment on column merge_log.qty is '合并数量';
comment on column merge_log.packs is '合并包装数';
comment on column merge_log.from_lpn is '源容器';
comment on column merge_log.to_lpn is '合并到容器';
comment on column merge_log.add_id is '记录人';
comment on column merge_log.add_name is '记录人姓名';
comment on column merge_log.add_date is '记录时间';

create table outbound
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	owner_id       				varchar2(30) not null,
	order_id 					varchar2(30) not null,
	extern_order_id				varchar2(30) not null,
	extern_rdc_id				varchar2(30),
	type_id 	 				nvarchar2(30) not null,
	customer_id 				varchar2(30) not null,
	print_count 				number default 0 not null,
	shipped_user_id 			varchar2(20),
	shipped_user_name 			nvarchar2(20),
	shipped_date 				date,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table outbound add constraint pk_outbound primary key (row_id) using index;
create unique index uidx_outbound on outbound (rdc_id,order_id);
comment on table outbound is '出库单';
comment on column outbound.row_id is 'uuid主键';
comment on column outbound.rdc_id is '物流中心';
comment on column outbound.owner_id is '货主';
comment on column outbound.order_id is '订单号';
comment on column outbound.extern_order_id is '外部单号';
comment on column outbound.extern_rdc_id is '外部物流中心';
comment on column outbound.type_id is '单据类型';
comment on column outbound.customer_id is '客户';
comment on column outbound.print_count is '打印次数';
comment on column outbound.shipped_user_id is '发货人';
comment on column outbound.shipped_user_name is '发货人姓名';
comment on column outbound.shipped_date is '发货时间';
comment on column outbound.status is '状态';
comment on column outbound.udf1 is '用户自定义1';
comment on column outbound.udf2 is '用户自定义2';
comment on column outbound.udf3 is '用户自定义3';
comment on column outbound.add_id is '记录人';
comment on column outbound.add_name is '记录人姓名';
comment on column outbound.add_date is '记录时间';
comment on column outbound.edit_id is '编辑人';
comment on column outbound.edit_name is '编辑人姓名';
comment on column outbound.edit_date is '编辑时间';

create table outbound_detail
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	outbound_row_id 			varchar2(32) not null,
	order_id 					varchar2(30) not null,
	line_id 					varchar2(30) not null,
	sku 						varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	uom 						varchar2(30) not null,
	lot 						varchar2(20) not null,
	qty 						number(22,5) not null,
	qty_shipped 				number(22,5) default 0 not null,
	pack_qty					number(22,5) default 1 not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table outbound_detail add constraint pk_outbound_detail primary key (row_id) using index;
create unique index uidx_outbound_detail on outbound_detail (rdc_id,order_id,line_id,outbound_row_id);
comment on table outbound_detail is '出库单明细';
comment on column outbound_detail.row_id is 'uuid主键';
comment on column outbound_detail.rdc_id is '物流中心';
comment on column outbound_detail.outbound_row_id is '出库单uuid主键';
comment on column outbound_detail.order_id is '订单号';
comment on column outbound_detail.line_id is '行号';
comment on column outbound_detail.sku is '货品';
comment on column outbound_detail.sku_descr is '货品描述';
comment on column outbound_detail.uom is '单位';
comment on column outbound_detail.lot is '批次';
comment on column outbound_detail.qty is '单据数量';
comment on column outbound_detail.qty_shipped is '发运数量';
comment on column outbound_detail.pack_qty is '包装含量';
comment on column outbound_detail.status is '状态';
comment on column outbound_detail.udf1 is '用户自定义1';
comment on column outbound_detail.udf2 is '用户自定义2';
comment on column outbound_detail.udf3 is '用户自定义3';
comment on column outbound_detail.add_id is '记录人';
comment on column outbound_detail.add_name is '记录人姓名';
comment on column outbound_detail.add_date is '记录时间';
comment on column outbound_detail.edit_id is '编辑人';
comment on column outbound_detail.edit_name is '编辑人姓名';
comment on column outbound_detail.edit_date is '编辑时间';

create table short_strategy
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	short_strategy_id			varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	create_physical				nvarchar2(1) default '否' not null,
	repeat_task 				nvarchar2(1) default '否' not null,
	inventory_hold 				nvarchar2(1) default '否' not null,
	hold_type 					nvarchar2(10) default '冻结拣货量' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table short_strategy add constraint pk_short_strategy primary key (row_id) using index;
create unique index uidx_short_strategy on short_strategy (rdc_id,short_strategy_id);
comment on table short_strategy is '短拣策略';
comment on column short_strategy.row_id is 'uuid主键';
comment on column short_strategy.rdc_id is '物流中心';
comment on column short_strategy.short_strategy_id is '短拣策略编码';
comment on column short_strategy.descr is '策略描述';
comment on column short_strategy.create_physical is '是否生成盘点任务';
comment on column short_strategy.repeat_task is '是否再次获取到任务';
comment on column short_strategy.inventory_hold is '是否冻结库存';
comment on column short_strategy.hold_type is '冻结方式:冻结拣货量/冻结库存记录';
comment on column short_strategy.udf1 is '用户自定义1';
comment on column short_strategy.udf2 is '用户自定义2';
comment on column short_strategy.udf3 is '用户自定义3';
comment on column short_strategy.add_id is '记录人';
comment on column short_strategy.add_name is '记录人姓名';
comment on column short_strategy.add_date is '记录时间';
comment on column short_strategy.edit_id is '编辑人';
comment on column short_strategy.edit_name is '编辑人姓名';
comment on column short_strategy.edit_date is '编辑时间';

create table status_log
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	voucher_id 					varchar2(30) not null,
	line_id 					varchar2(30),
	voucher_source 				nvarchar2(30) not null,
	qty 						number(22,5) default 0 not null,
	status 						varchar2(10),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table status_log add constraint pk_status_log primary key (row_id) using index;
comment on table status_log is '单据状态更变日志';
comment on column status_log.row_id is 'uuid主键';
comment on column status_log.rdc_id is '物流中心';
comment on column status_log.voucher_id is '单据号';
comment on column status_log.line_id is '行号';
comment on column status_log.voucher_source is '单据来源';
comment on column status_log.qty is '数量';
comment on column status_log.status is '状态';
comment on column status_log.add_id is '记录人';
comment on column status_log.add_name is '记录人姓名';
comment on column status_log.add_date is '记录时间';

create table adjustment
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	adjustment_id 				varchar2(30) not null,
	owner_id 					varchar2(30) not null,
	adjustment_user_id 			varchar2(20),
	adjustment_user_name		nvarchar2(20),
	adjustment_date 			date,
	physical_id 				varchar2(30),
	status 						varchar2(10),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table adjustment add constraint pk_adjustment primary key (row_id) using index;
create unique index uidx_adjustment on adjustment (rdc_id,adjustment_id);
comment on table adjustment is '库存调整单';
comment on column adjustment.row_id is 'uuid主键';
comment on column adjustment.rdc_id is '物流中心';
comment on column adjustment.adjustment_id is '调整单号';
comment on column adjustment.owner_id is '货主';
comment on column adjustment.adjustment_user_id is '调整人';
comment on column adjustment.adjustment_user_name is '调整人姓名';
comment on column adjustment.adjustment_date is '调整日期';
comment on column adjustment.physical_id is '盘点单号';
comment on column adjustment.status is '状态';
comment on column adjustment.add_id is '记录人';
comment on column adjustment.add_name is '记录人姓名';
comment on column adjustment.add_date is '记录时间';

create table adjustment_detail
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	adjustment_id 				varchar2(30) not null,
	line_id 					varchar2(30) not null,
	owner_id 					varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	lot 						varchar2(20) not null,
	loc_id  					varchar2(30) not null,
	container_id  				varchar2(30) default ' ' not null,
	adjustment_reason			nvarchar2(30) not null,
	uom 						varchar2(30) not null,
	pack_qty  					number(22,5) not null,
	packs 						number(22,5) not null,
	qty 						number(22,5) not null,
	cube 						number(22,5) default 0 not null,
	gross_weight 				number(22,5) default 0 not null,
	net_weight 					number(22,5) default 0 not null,
	inventory_log_row_id 		varchar2(32),
	status 						varchar2(10) not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table adjustment_detail add constraint pk_adjustment_detail primary key (row_id) using index;
create unique index uidx_adjustment_detail on adjustment_detail (rdc_id,adjustment_id,line_id);
comment on table adjustment_detail is '库存调整明细';
comment on column adjustment_detail.row_id is 'uuid主键';
comment on column adjustment_detail.rdc_id is '物流中心';
comment on column adjustment_detail.adjustment_id is '调整单号';
comment on column adjustment_detail.line_id is '行号';
comment on column adjustment_detail.owner_id is '货主';
comment on column adjustment_detail.sku is '货品';
comment on column adjustment_detail.sku_descr is '货品描述';
comment on column adjustment_detail.lot is '批次';
comment on column adjustment_detail.loc_id is '库位';
comment on column adjustment_detail.container_id is '容器';
comment on column adjustment_detail.adjustment_reason is '调整原因';
comment on column adjustment_detail.uom is '单位';
comment on column adjustment_detail.pack_qty is '实际主包装含量';
comment on column adjustment_detail.packs is '包装数量';
comment on column adjustment_detail.qty is '数量';
comment on column adjustment_detail.cube is '体积';
comment on column adjustment_detail.gross_weight is '毛重';
comment on column adjustment_detail.net_weight is '净重';
comment on column adjustment_detail.inventory_log_row_id is '库存交易uuid';
comment on column adjustment_detail.status is '状态';
comment on column adjustment_detail.add_id is '记录人';
comment on column adjustment_detail.add_name is '记录人姓名';
comment on column adjustment_detail.add_date is '记录时间';

create table move
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	move_id 					varchar2(30) not null,
	move_type					nvarchar2(30) not null,
	move_reason 				nvarchar2(30) not null,
	owner_id 					varchar2(30) not null,
	status 						varchar2(10),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table move add constraint pk_move primary key (row_id) using index;
create unique index uidx_move on move (rdc_id,move_id);
comment on table move is '移动单';
comment on column move.row_id is 'uuid主键';
comment on column move.rdc_id is '物流中心';
comment on column move.move_id is '移动单号';
comment on column move.move_type is '移动类型';
comment on column move.move_reason is '移动原因';
comment on column move.owner_id is '货主';
comment on column move.status is '状态';
comment on column move.udf1 is '用户自定义1';
comment on column move.udf2 is '用户自定义2';
comment on column move.udf3 is '用户自定义3';
comment on column move.udf4 is '用户自定义4';
comment on column move.udf5 is '用户自定义5';
comment on column move.add_id is '记录人';
comment on column move.add_name is '记录人姓名';
comment on column move.add_date is '记录时间';

create table move_detail
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	move_id 					varchar2(30) not null,
	line_id						varchar2(30) not null,
	owner_id 					varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	lot 						varchar2(20) not null,
	from_loc_id  				varchar2(30) not null,
	from_container_id  			varchar2(30) default ' ' not null,
	to_loc_id  					varchar2(30),
	to_container_id  			varchar2(30) default ' ' not null,
	pack_qty  					number(22,5) not null,
	packs 						number(22,5) not null,
	qty 						number(22,5) not null,
	cube 						number(22,5) default 0 not null,
	gross_weight 				number(22,5) default 0 not null,
	net_weight 					number(22,5) default 0 not null,
	uom 						varchar2(30) not null,
	status 						varchar2(10),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table move_detail add constraint pk_move_detail primary key (row_id) using index;
create unique index uidx_move_detail on move_detail (rdc_id,move_id,line_id);
comment on table move_detail is '移动单明细';
comment on column move_detail.row_id is 'uuid主键';
comment on column move_detail.rdc_id is '物流中心';
comment on column move_detail.move_id is '移动单号';
comment on column move_detail.line_id is '行号';
comment on column move_detail.owner_id is '货主';
comment on column move_detail.sku is '货品';
comment on column move_detail.sku_descr is '货品描述';
comment on column move_detail.lot is '批次';
comment on column move_detail.from_loc_id is '从库位';
comment on column move_detail.from_container_id is '从容器';
comment on column move_detail.to_loc_id is '到库位';
comment on column move_detail.to_container_id is '到容器';
comment on column move_detail.pack_qty is '实际主包装含量';
comment on column move_detail.packs is '包装数量';
comment on column move_detail.qty is '数量';
comment on column move_detail.cube is '体积';
comment on column move_detail.gross_weight is '毛重';
comment on column move_detail.net_weight is '净重';
comment on column move_detail.uom is '单位';
comment on column move_detail.status is '状态'; ('00':初始状态 '50': '上架完成')
comment on column move_detail.udf1 is '用户自定义1';
comment on column move_detail.udf2 is '用户自定义2';
comment on column move_detail.udf3 is '用户自定义3';
comment on column move_detail.udf4 is '用户自定义4';
comment on column move_detail.udf5 is '用户自定义5';
comment on column move_detail.add_id is '记录人';
comment on column move_detail.add_name is '记录人姓名';
comment on column move_detail.add_date is '记录时间';

create table replenishment
(
   row_id               	 	varchar2(32) not null,
   rdc_id                		varchar2(30) not null,
   owner_id               		varchar2(30) not null,
   sku                    		varchar2(30) not null,
   sku_descr              		nvarchar2(60) not null,   
   lot                   		varchar2(20) not null,
   wave_id 						varchar2(30) not null,
   group_id 					varchar2(30),
   task_id 						varchar2(30),
   from_area_id            		varchar2(30) not null,
   from_loc_id             		varchar2(30) not null,
   from_container_id            varchar2(30) default ' ' not null,
   to_area_id                 	varchar2(30) not null,
   to_loc_id                  	varchar2(30),
   to_container_id          	varchar2(30) default ' ' not null,
   loc_group_id					varchar2(30) not null,
   pack_qty               		number(22,5) not null,
   packs                 		number(22,5) not null,
   qty                   		number(22,5) not null,
   actual_qty                 	number(22,5) default 0 not null,
   pick_to       				varchar2(30) not null,
   cube                  		number(22,5) default 0 not null,
   gross_weight            		number(22,5) default 0 not null,
   net_weight                 	number(22,5) default 0 not null,
   uom                   		varchar2(30) not null,
   priority               		number default 1 not null,
   print_count              	number default 0 not null,
   equipment_type          		nvarchar2(20) not null,
   pick_user_id            		varchar2(20),
   pick_user_name              	nvarchar2(20),
   pick_date                  	date,
   putaway_user_id          	varchar2(20),
   putaway_user_name        	nvarchar2(20),
   putaway_date            		date,
   status                    	varchar2(10),
   distributionflag         	varchar2(2) default 'N' not null,
   wmstype                      varchar2(10), 
   udf1                    		varchar2(50),
   udf2                    		varchar2(50),
   udf3                    		varchar2(50),
   add_id                		varchar2(20),
   add_name               		nvarchar2(20),
   add_date               		date default sysdate,
   repl_type                    nvarchar2(30) default '标签补货' not null;
);
alter table replenishment add constraint pk_replenishment primary key (row_id) using index;
comment on table replenishment is '补货任务';
comment on column replenishment.row_id is 'uuid主键';
comment on column replenishment.rdc_id is '物流中心';
comment on column replenishment.owner_id is '货主';
comment on column replenishment.sku is '货品';
comment on column replenishment.sku_descr is '货品描述';
comment on column replenishment.lot is '批次';
comment on column replenishment.wave_id is '波次';
comment on column replenishment.group_id is '任务组';
comment on column replenishment.task_id is '任务顺序号';
comment on column replenishment.from_area_id is '从库区';
comment on column replenishment.from_loc_id is '从库位';
comment on column replenishment.from_container_id is '从容器';
comment on column replenishment.to_area_id is '到库区';
comment on column replenishment.to_loc_id is '到库位';
comment on column replenishment.to_container_id is '到容器';
comment on column replenishment.loc_group_id is '库位组:电子标签的区段可以使用';
comment on column replenishment.pack_qty is '实际主包装含量';
comment on column replenishment.packs is '包装数量';
comment on column replenishment.qty is '数量';
comment on column replenishment.actual_qty is '实际数量';
comment on column replenishment.pick_to is '拣货到库位';
comment on column replenishment.cube is '体积';
comment on column replenishment.gross_weight is '毛重';
comment on column replenishment.net_weight is '净重';
comment on column replenishment.uom is '单位';
comment on column replenishment.priority is '优先级';
comment on column replenishment.print_count is '打印次数';
comment on column replenishment.equipment_type is '搬运设备';
comment on column replenishment.pick_user_id is '下架人';
comment on column replenishment.pick_user_name is '下架人姓名';
comment on column replenishment.pick_date is '下架日期';
comment on column replenishment.putaway_user_id is '上架人';
comment on column replenishment.putaway_user_name is '上架人姓名';
comment on column replenishment.putaway_date is '上架日期';
comment on column replenishment.status is '状态：00初始状态/20补货中/25补货异常/30补货完成';
comment on column replenishment.distributionflag is '上架任务是否已下发给wcs N:否 Y:是';
comment on column replenishment.wmstype is '任务类型：1整托任务/2机械臂拆垛任务/3人工拆垛';
comment on column replenishment.udf1 is '用户自定义1';
comment on column replenishment.udf2 is '用户自定义2';
comment on column replenishment.udf3 is '用户自定义3';
comment on column replenishment.add_id is '记录人';
comment on column replenishment.add_name is '记录人姓名';
comment on column replenishment.add_date is '记录时间';
comment on column replenishment.repl_type is '补货类型:标签补货/任务补货';

create table interface_log
(
   row_id						varchar2(32) not null,
   request_url       			varchar2(50) not null,
   buz_description   			nvarchar2(100) not null,
   wms_id						varchar2(32),
   container_id 				varchar2(30),
   state    			   		number,
   flag    			   			number,
   message						nvarchar2(200),
   in_param         			varchar2(500) not null,
   out_param			 		nvarchar2(500) not null,
   add_date						date default sysdate,
   edit_date					date,
   request_count     			number default 1 not null
);
alter table interface_log add constraint pk_interface_log primary key (row_id) using index;
create unique index uidx_interface_log on interface_log (buz_description,in_param,out_param);
comment on table interface_log is '设备接口调用日志';
comment on column interface_log.row_id is 'uuid主键';
comment on column interface_log.request_url is '请求url';
comment on column interface_log.buz_description is '业务描述';
comment on column interface_log.wms_id is 'WMS任务号';
comment on column interface_log.container_id is '托盘号';
comment on column interface_log.state is '回传标识';
comment on column interface_log.flag is 'WMS处理标志';
comment on column interface_log.message is '处理失败原因';
comment on column interface_log.in_param is '传入参数';
comment on column interface_log.out_param is '传出参数';
comment on column interface_log.add_date is '记录时间';
comment on column interface_log.edit_date is '编辑时间';
comment on column interface_log.request_count is '请求次数';

create table user_operation_log
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	client_type 				varchar2(2) not null,	
	module 						varchar2(30) not null,
	button 						varchar2(30) not null,
	log_type					nvarchar2(20) not null,		
	udf1       					varchar2(50),
	udf2       					varchar2(50),
	udf3       					varchar2(50),
	udf4       					varchar2(50),
	udf5       					varchar2(50),
	udf6       					varchar2(50),
	udf7       					varchar2(50),
	udf8       					varchar2(50),
	udf9       					varchar2(50),
	udf10      					varchar2(50),
	udf11       				varchar2(50),
	udf12       				varchar2(50),
	udf13       				varchar2(50),
	udf14       				varchar2(50),
	udf15       				varchar2(50),
	udf16       				varchar2(50),
	udf17       				varchar2(50),
	udf18       				varchar2(50),
	udf19       				varchar2(50),
	udf20      					varchar2(50),	
	notes						nvarchar2(500),
	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table user_operation_log add constraint pk_user_operation_log primary key (row_id) using index;
comment on table user_operation_log is '人员操作日志';
comment on column user_operation_log.row_id is 'uuid主键';
comment on column user_operation_log.rdc_id is '物流中心';
comment on column user_operation_log.client_type is '客户端类型:PC/RF';
comment on column user_operation_log.module is '模块名称';
comment on column user_operation_log.button is '按钮名称';
comment on column user_operation_log.log_type is '日志类型';
comment on column user_operation_log.udf1 is '用户自定义1';
comment on column user_operation_log.udf2 is '用户自定义2';
comment on column user_operation_log.udf3 is '用户自定义3';
comment on column user_operation_log.udf4 is '用户自定义4';
comment on column user_operation_log.udf5 is '用户自定义5';
comment on column user_operation_log.udf6 is '用户自定义6';
comment on column user_operation_log.udf7 is '用户自定义7';
comment on column user_operation_log.udf8 is '用户自定义8';
comment on column user_operation_log.udf9 is '用户自定义9';
comment on column user_operation_log.udf10 is '用户自定义10';
comment on column user_operation_log.udf11 is '用户自定义11';
comment on column user_operation_log.udf12 is '用户自定义12';
comment on column user_operation_log.udf13 is '用户自定义13';
comment on column user_operation_log.udf14 is '用户自定义14';
comment on column user_operation_log.udf15 is '用户自定义15';
comment on column user_operation_log.udf16 is '用户自定义16';
comment on column user_operation_log.udf17 is '用户自定义17';
comment on column user_operation_log.udf18 is '用户自定义18';
comment on column user_operation_log.udf19 is '用户自定义19';
comment on column user_operation_log.udf20 is '用户自定义20';
comment on column user_operation_log.notes is '备注';
comment on column user_operation_log.add_id is '记录人';
comment on column user_operation_log.add_name is '记录人姓名';
comment on column user_operation_log.add_date is '记录时间';

create table base_info_log
(
	row_id						varchar2(32) not null,
	base_info_row_id			varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	module 						varchar2(30) not null,
	operation_type				nvarchar2(20) not null,
	from_table_info 			CLOB,
	to_table_info 				CLOB,
	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table base_info_log add constraint pk_base_info_log primary key (row_id) using index;
comment on table base_info_log is '基础资料变更日志';
comment on column base_info_log.row_id is 'uuid主键';
comment on column base_info_log.base_info_row_id is '基础资料表uuid主键';
comment on column base_info_log.rdc_id is '物流中心';
comment on column base_info_log.module is '模块名称';
comment on column base_info_log.operation_type is '操作类型：新增/修改/删除';
comment on column base_info_log.from_table_info is '变更前表数据';
comment on column base_info_log.to_table_info is '变更后表数据';
comment on column base_info_log.add_id is '记录人';
comment on column base_info_log.add_name is '记录人姓名';
comment on column base_info_log.add_date is '记录时间';

create table diff_inventory_log
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	warehouse_id				varchar2(30) not null,
	area_id 					varchar2(30) not null,
	diff_loc 					varchar2(30) not null,
	diff_source       			nvarchar2(20) not null,
	lot 						varchar2(20) not null,
	owner_id       				varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	pack_qty  					number(22,5) not null,
	packs 						number(22,5) not null,
	qty 						number(22,5) not null,
	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table diff_inventory_log add constraint pk_diff_inventory_log primary key (row_id) using index;
comment on table diff_inventory_log is '差异库位库存生成日志';
comment on column diff_inventory_log.row_id is 'uuid主键';
comment on column diff_inventory_log.rdc_id is '物流中心';
comment on column diff_inventory_log.warehouse_id is '仓库编码';
comment on column diff_inventory_log.area_id is '库区编码';
comment on column diff_inventory_log.diff_loc is '差异库位';
comment on column diff_inventory_log.diff_source is '差异来源';
comment on column diff_inventory_log.lot is '批次';
comment on column diff_inventory_log.owner_id is '货主';
comment on column diff_inventory_log.sku is '货品';
comment on column diff_inventory_log.sku_descr is '货品描述';
comment on column diff_inventory_log.pack_qty is '实际主包装含量';
comment on column diff_inventory_log.packs is '差异箱数';
comment on column diff_inventory_log.qty is '差异数量';
comment on column diff_inventory_log.add_id is '记录人';
comment on column diff_inventory_log.add_name is '记录人姓名';
comment on column diff_inventory_log.add_date is '记录时间';

create table inventory_log
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	source_id 					varchar2(30),
	source_line_id 				varchar2(30),
	source_type 				varchar2(30) not null,
	lot 						varchar2(20) not null,
	owner_id       				varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	from_loc_id  				varchar2(30) not null,
	from_container_id  			varchar2(30) default ' ' not null,
	to_loc_id  					varchar2(30),
	to_container_id  			varchar2(30) default ' ' not null,
	pack_qty  					number(22,5) not null,
	from_packs 					number(22,5) not null,
	from_qty 					number(22,5) not null,
	to_packs 					number(22,5) not null,
	to_qty 						number(22,5) not null,
	cube 						number(22,5) default 0 not null,
	gross_weight 				number(22,5) default 0 not null,
	net_weight 					number(22,5) default 0 not null,
	uom 						varchar2(30) not null,
	status 						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
    notes						varchar2(500),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table inventory_log add constraint pk_inventory_log primary key (row_id) using index;
comment on table inventory_log is '库位库存变动日志';
comment on column inventory_log.row_id is 'uuid主键';
comment on column inventory_log.rdc_id is '物流中心';
comment on column inventory_log.source_id is '交易单号';
comment on column inventory_log.source_line_id is '交易行号';
comment on column inventory_log.source_type is '交易类型';
comment on column inventory_log.lot is '批次';
comment on column inventory_log.owner_id is '货主';
comment on column inventory_log.sku is '货品';
comment on column inventory_log.sku_descr is '货品描述';
comment on column inventory_log.from_loc_id is '从库位';
comment on column inventory_log.from_container_id is '从容器';
comment on column inventory_log.to_loc_id is '到库位';
comment on column inventory_log.to_container_id is '到容器';
comment on column inventory_log.pack_qty is '实际主包装含量';
comment on column inventory_log.from_packs is '变更前包装数量';
comment on column inventory_log.from_qty is '变更前数量';
comment on column inventory_log.to_packs is '变更后包装数量';
comment on column inventory_log.to_qty is '变更后数量';
comment on column inventory_log.cube is '体积';
comment on column inventory_log.gross_weight is '毛重';
comment on column inventory_log.net_weight is '净重';
comment on column inventory_log.uom is '单位';
comment on column inventory_log.status is '状态';
comment on column inventory_log.udf1 is '用户自定义1';
comment on column inventory_log.udf2 is '用户自定义2';
comment on column inventory_log.udf3 is '用户自定义3';
comment on column inventory_log.udf4 is '用户自定义4';
comment on column inventory_log.udf5 is '用户自定义5';
comment on column inventory_log.notes is '备注';
comment on column inventory_log.add_id is '记录人';
comment on column inventory_log.add_name is '记录人姓名';
comment on column inventory_log.add_date is '记录时间';

create table physical_mould
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	physical_mould_id 			varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	warehouse_id 				varchar2(30),
	owner_id 					varchar2(30),
	sku 	 				 	varchar2(30),
	sku_sort 					varchar2(20),
	sku_abc  					varchar2(10),
	lot 						varchar2(20),
	region_id					varchar2(30),
	area_start 					varchar2(30),
	area_end 					varchar2(30),
	shelves_type				varchar2(30),
	loc_type                 	varchar2(30),
	loc_start 					varchar2(30),
	loc_end 					varchar2(30),
	loc_level_start				number default 0 not null,
	loc_level_end				number default 0 not null,
	loc_abc  					varchar2(10),
	show_qty 					nvarchar2(1) default '否' not null,
	threshold_qty 				number(22,5) default 0 not null,
	include_zero 				nvarchar2(1) default '否' not null,
	ab_group 					nvarchar2(1) default '否' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table physical_mould add constraint pk_physical_mould primary key (row_id) using index;
create unique index uidx_physical_mould on physical_mould (rdc_id,physical_mould_id);
comment on table physical_mould is '盘点模板';
comment on column physical_mould.row_id is 'uuid主键';
comment on column physical_mould.rdc_id is '物流中心';
comment on column physical_mould.physical_mould_id is '盘点模板编码';
comment on column physical_mould.descr is '模板描述';
comment on column physical_mould.warehouse_id is '仓库';
comment on column physical_mould.owner_id is '货主';
comment on column physical_mould.sku is '货品';
comment on column physical_mould.sku_sort is '货品分类';
comment on column physical_mould.sku_abc is '货品ABC';
comment on column physical_mould.lot is '批次';
comment on column physical_mould.region_id is '区域';
comment on column physical_mould.area_start is '开始库区';
comment on column physical_mould.area_end is '结束库区';
comment on column physical_mould.shelves_type is '货架类型 密集库 自动库 高位货架 平面拆零 搁板拆零 电子标签';
comment on column physical_mould.loc_type is '库位类型 CS:整箱存储 EA:拆零存储 PL:整托存储 NONE:不限 DOCK:集货';
comment on column physical_mould.loc_start is '开始库位';
comment on column physical_mould.loc_end is '结束库位';
comment on column physical_mould.loc_level_start is '开始库位层';
comment on column physical_mould.loc_level_end is '结束库位层';
comment on column physical_mould.loc_abc is '库位ABC';
comment on column physical_mould.show_qty is '是否显示库存数量';
comment on column physical_mould.threshold_qty is '库存低于阈值才生成盘点';
comment on column physical_mould.include_zero is '零库存是否生成盘点任务';
comment on column physical_mould.ab_group is '是否生成AB两组任务';
comment on column physical_mould.udf1 is '用户自定义1';
comment on column physical_mould.udf2 is '用户自定义2';
comment on column physical_mould.udf3 is '用户自定义3';
comment on column physical_mould.udf4 is '用户自定义4';
comment on column physical_mould.udf5 is '用户自定义5';
comment on column physical_mould.add_id is '记录人';
comment on column physical_mould.add_name is '记录人姓名';
comment on column physical_mould.add_date is '记录时间';
comment on column physical_mould.edit_id is '编辑人';
comment on column physical_mould.edit_name is '编辑人姓名';
comment on column physical_mould.edit_date is '编辑时间';

--通过wms_config参数控制20条生成一个盘点单号
create table physical
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	physical_id 				varchar2(30) not null,
	line_id 					varchar2(30) not null,
	ab_group 					varchar2(2) default 'A' not null,
	owner_id 					varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	lot 						varchar2(20) not null,
	area_id 					varchar2(30) not null,
	loc_id 					 	varchar2(30) not null,
	pick_to       				varchar2(30) not null,
	container_id 				varchar2(30) default ' ' not null,
	pack_qty  					number(22,5) not null,
	packs 						number(22,5) not null,
	inventory_qty 				number(22,5) default 0 not null,
	physical_qty				number(22,5) default 0 not null,
	physical_mould_id 			varchar2(30) not null,
	physical_user_id 			varchar2(20),
	physical_user_name			nvarchar2(20),
	physical_date				date,
	status 						varchar2(10),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table physical add constraint pk_physical primary key (row_id) using index;
create unique index uidx_physical on physical (rdc_id,physical_id,line_id,ab_group);
comment on table physical is '库存盘点';
comment on column physical.row_id is 'uuid主键';
comment on column physical.rdc_id is '物流中心';
comment on column physical.physical_id is '盘点单号';
comment on column physical.line_id is '行号';
comment on column physical.ab_group is 'AB组';
comment on column physical.owner_id is '货主';
comment on column physical.sku is '货品';
comment on column physical.sku_descr is '货品描述';
comment on column physical.lot is '批次';
comment on column physical.area_id is '库区';
comment on column physical.loc_id is '库位';
comment on column physical.pick_to is '拣货到库位';
comment on column physical.container_id is '容器';
comment on column physical.inventory_qty is '盘点时即时库存数量';
comment on column physical.pack_qty is '盘点时即时库存包装含量';
comment on column physical.packs is '盘点时即时库存包装数';
comment on column physical.physical_qty is '盘点数量';
comment on column physical.physical_mould_id is '盘点模板编码';
comment on column physical.physical_user_id is '盘点人';
comment on column physical.physical_user_name is '盘点人姓名';
comment on column physical.physical_date is '盘点日期';
comment on column physical.status is '状态:00初始状态/10分组完成/20任务已下发/30出库完成/40盘点完成/90盘点异常';
comment on column physical.udf1 is '用户自定义1';
comment on column physical.udf2 is '用户自定义2';
comment on column physical.udf3 is '用户自定义3';
comment on column physical.add_id is '记录人';
comment on column physical.add_name is '记录人姓名';
comment on column physical.add_date is '记录时间';

create table lot_validation
(
	row_id						varchar2(32) not null,
	lot_validation_id 			varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	show_lot01 					nvarchar2(1) default '否' not null,
	show_lot02 					nvarchar2(1) default '否' not null,
	show_lot03 					nvarchar2(1) default '否' not null,
	show_lot04 					nvarchar2(1) default '否' not null,
	show_lot05 					nvarchar2(1) default '否' not null,
	show_lot06 					nvarchar2(1) default '否' not null,
	show_lot07 					nvarchar2(1) default '否' not null,
	show_lot08 					nvarchar2(1) default '否' not null,
	show_lot09 					nvarchar2(1) default '否' not null,
	show_lot10 					nvarchar2(1) default '否' not null,
	show_lot11 					nvarchar2(1) default '否' not null,
	show_lot12 					nvarchar2(1) default '否' not null,
	show_lot13 					nvarchar2(1) default '否' not null,
	show_lot14 					nvarchar2(1) default '否' not null,
	show_lot15 					nvarchar2(1) default '否' not null,
	show_lot16 					nvarchar2(1) default '否' not null,
	show_lot17 					nvarchar2(1) default '否' not null,
	show_lot18 					nvarchar2(1) default '否' not null,
	show_lot19 					nvarchar2(1) default '否' not null,
	show_lot20 					nvarchar2(1) default '否' not null,
	required_lot01 				nvarchar2(1) default '否' not null,
	required_lot02 				nvarchar2(1) default '否' not null,
	required_lot03 				nvarchar2(1) default '否' not null,
	required_lot04 				nvarchar2(1) default '否' not null,
	required_lot05 				nvarchar2(1) default '否' not null,
	required_lot06 				nvarchar2(1) default '否' not null,
	required_lot07 				nvarchar2(1) default '否' not null,
	required_lot08 				nvarchar2(1) default '否' not null,
	required_lot09 				nvarchar2(1) default '否' not null,
	required_lot10 				nvarchar2(1) default '否' not null,
	required_lot11 				nvarchar2(1) default '否' not null,
	required_lot12 				nvarchar2(1) default '否' not null,
	required_lot13 				nvarchar2(1) default '否' not null,
	required_lot14 				nvarchar2(1) default '否' not null,
	required_lot15 				nvarchar2(1) default '否' not null,
	required_lot16 				nvarchar2(1) default '否' not null,
	required_lot17 				nvarchar2(1) default '否' not null,
	required_lot18 				nvarchar2(1) default '否' not null,
	required_lot19 				nvarchar2(1) default '否' not null,
	required_lot20 				nvarchar2(1) default '否' not null,
	mask_lot01 					varchar2(200) default '否' not null,
	mask_lot02 					varchar2(200) default '否' not null,
	mask_lot03 					varchar2(200) default '否' not null,
	mask_lot04 					varchar2(200) default '否' not null,
	mask_lot05 					varchar2(200) default '否' not null,
	mask_lot06 					varchar2(200) default '否' not null,
	mask_lot07 					varchar2(200) default '否' not null,
	mask_lot08 					varchar2(200) default '否' not null,
	mask_lot09 					varchar2(200) default '否' not null,
	mask_lot10 					varchar2(200) default '否' not null,
	mask_lot11 					varchar2(200) default '否' not null,
	mask_lot12 					varchar2(200) default '否' not null,
	mask_lot13 					varchar2(200) default '否' not null,
	mask_lot14 					varchar2(200) default '否' not null,
	max_length_lot01 			number default 30 not null,
	max_length_lot02 			number default 30 not null,
	max_length_lot03 			number default 30 not null,
	max_length_lot04 			number default 30 not null,
	max_length_lot05 			number default 30 not null,
	max_length_lot06 			number default 30 not null,
	max_length_lot07 			number default 30 not null,
	max_length_lot08 			number default 30 not null,
	max_length_lot09 			number default 30 not null,
	max_length_lot10 			number default 30 not null,
	max_length_lot11 			number default 30 not null,
	max_length_lot12 			number default 30 not null,
	max_length_lot13 			number default 30 not null,
	max_length_lot14 			number default 30 not null,
	lot01_label					nvarchar2(30),
	lot02_label					nvarchar2(30),
	lot03_label					nvarchar2(30),
	lot04_label					nvarchar2(30),
	lot05_label					nvarchar2(30),
	lot06_label					nvarchar2(30),
	lot07_label					nvarchar2(30),
	lot08_label					nvarchar2(30),
	lot09_label					nvarchar2(30),
	lot10_label					nvarchar2(30),
	lot11_label					nvarchar2(30),
	lot12_label					nvarchar2(30),
	lot13_label					nvarchar2(30),
	lot14_label					nvarchar2(30),
	lot15_label					nvarchar2(30),
	lot16_label					nvarchar2(30),
	lot17_label					nvarchar2(30),
	lot18_label					nvarchar2(30),
	lot19_label					nvarchar2(30),
	lot20_label					nvarchar2(30),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table lot_validation add constraint pk_lot_validation primary key (row_id) using index;
create unique index uidx_lot_validation on lot_validation (lot_validation_id);
comment on table lot_validation is '批属性验证';
comment on column lot_validation.row_id is 'uuid主键';
comment on column lot_validation.lot_validation_id is '批属性验证编码';
comment on column lot_validation.descr is '验证描述';
comment on column lot_validation.show_lot01 is '批属性01RF收货时是否显示';
comment on column lot_validation.show_lot02 is '批属性02RF收货时是否显示';
comment on column lot_validation.show_lot03 is '批属性03RF收货时是否显示';
comment on column lot_validation.show_lot04 is '批属性04RF收货时是否显示';
comment on column lot_validation.show_lot05 is '批属性05RF收货时是否显示';
comment on column lot_validation.show_lot06 is '批属性06RF收货时是否显示';
comment on column lot_validation.show_lot07 is '批属性07RF收货时是否显示';
comment on column lot_validation.show_lot08 is '批属性08RF收货时是否显示';
comment on column lot_validation.show_lot09 is '批属性09RF收货时是否显示';
comment on column lot_validation.show_lot10 is '批属性10RF收货时是否显示';
comment on column lot_validation.show_lot11 is '批属性11RF收货时是否显示';
comment on column lot_validation.show_lot12 is '批属性12RF收货时是否显示';
comment on column lot_validation.show_lot13 is '批属性13RF收货时是否显示';
comment on column lot_validation.show_lot14 is '批属性14RF收货时是否显示';
comment on column lot_validation.show_lot15 is '批属性15RF收货时是否显示';
comment on column lot_validation.show_lot16 is '批属性16RF收货时是否显示';
comment on column lot_validation.show_lot17 is '批属性17RF收货时是否显示';
comment on column lot_validation.show_lot18 is '批属性18RF收货时是否显示';
comment on column lot_validation.show_lot19 is '批属性19RF收货时是否显示';
comment on column lot_validation.show_lot20 is '批属性20RF收货时是否显示';
comment on column lot_validation.required_lot01 is '批属性01RF收货时是否必须输入';
comment on column lot_validation.required_lot02 is '批属性02RF收货时是否必须输入';
comment on column lot_validation.required_lot03 is '批属性03RF收货时是否必须输入';
comment on column lot_validation.required_lot04 is '批属性04RF收货时是否必须输入';
comment on column lot_validation.required_lot05 is '批属性05RF收货时是否必须输入';
comment on column lot_validation.required_lot06 is '批属性06RF收货时是否必须输入';
comment on column lot_validation.required_lot07 is '批属性07RF收货时是否必须输入';
comment on column lot_validation.required_lot08 is '批属性08RF收货时是否必须输入';
comment on column lot_validation.required_lot09 is '批属性09RF收货时是否必须输入';
comment on column lot_validation.required_lot10 is '批属性10RF收货时是否必须输入';
comment on column lot_validation.required_lot11 is '批属性11RF收货时是否必须输入';
comment on column lot_validation.required_lot12 is '批属性12RF收货时是否必须输入';
comment on column lot_validation.required_lot13 is '批属性13RF收货时是否必须输入';
comment on column lot_validation.required_lot14 is '批属性14RF收货时是否必须输入';
comment on column lot_validation.required_lot15 is '批属性15RF收货时是否必须输入';
comment on column lot_validation.required_lot16 is '批属性16RF收货时是否必须输入';
comment on column lot_validation.required_lot17 is '批属性17RF收货时是否必须输入';
comment on column lot_validation.required_lot18 is '批属性18RF收货时是否必须输入';
comment on column lot_validation.required_lot19 is '批属性19RF收货时是否必须输入';
comment on column lot_validation.required_lot20 is '批属性20RF收货时是否必须输入';
comment on column lot_validation.mask_lot01 is '批属性01掩码';
comment on column lot_validation.mask_lot02 is '批属性02掩码';
comment on column lot_validation.mask_lot03 is '批属性03掩码';
comment on column lot_validation.mask_lot04 is '批属性04掩码';
comment on column lot_validation.mask_lot05 is '批属性05掩码';
comment on column lot_validation.mask_lot06 is '批属性06掩码';
comment on column lot_validation.mask_lot07 is '批属性07掩码';
comment on column lot_validation.mask_lot08 is '批属性08掩码';
comment on column lot_validation.mask_lot09 is '批属性09掩码';
comment on column lot_validation.mask_lot10 is '批属性10掩码';
comment on column lot_validation.mask_lot11 is '批属性11掩码';
comment on column lot_validation.mask_lot12 is '批属性12掩码';
comment on column lot_validation.mask_lot13 is '批属性13掩码';
comment on column lot_validation.mask_lot14 is '批属性14掩码';
comment on column lot_validation.max_length_lot01 is '批属性01最大长度';
comment on column lot_validation.max_length_lot02 is '批属性02最大长度';
comment on column lot_validation.max_length_lot03 is '批属性03最大长度';
comment on column lot_validation.max_length_lot04 is '批属性04最大长度';
comment on column lot_validation.max_length_lot05 is '批属性05最大长度';
comment on column lot_validation.max_length_lot06 is '批属性06最大长度';
comment on column lot_validation.max_length_lot07 is '批属性07最大长度';
comment on column lot_validation.max_length_lot08 is '批属性08最大长度';
comment on column lot_validation.max_length_lot09 is '批属性09最大长度';
comment on column lot_validation.max_length_lot10 is '批属性10最大长度';
comment on column lot_validation.max_length_lot11 is '批属性11最大长度';
comment on column lot_validation.max_length_lot12 is '批属性12最大长度';
comment on column lot_validation.max_length_lot13 is '批属性13最大长度';
comment on column lot_validation.max_length_lot14 is '批属性14最大长度';
comment on column lot_validation.lot01_label is '批属性01标签';
comment on column lot_validation.lot02_label is '批属性02标签';
comment on column lot_validation.lot03_label is '批属性03标签';
comment on column lot_validation.lot04_label is '批属性04标签';
comment on column lot_validation.lot05_label is '批属性05标签';
comment on column lot_validation.lot06_label is '批属性06标签';
comment on column lot_validation.lot07_label is '批属性07标签';
comment on column lot_validation.lot08_label is '批属性08标签';
comment on column lot_validation.lot09_label is '批属性09标签';
comment on column lot_validation.lot10_label is '批属性10标签';
comment on column lot_validation.lot11_label is '批属性11标签';
comment on column lot_validation.lot12_label is '批属性12标签';
comment on column lot_validation.lot13_label is '批属性13标签';
comment on column lot_validation.lot14_label is '批属性14标签';
comment on column lot_validation.lot15_label is '批属性15标签';
comment on column lot_validation.lot16_label is '批属性16标签';
comment on column lot_validation.lot17_label is '批属性17标签';
comment on column lot_validation.lot18_label is '批属性18标签';
comment on column lot_validation.lot19_label is '批属性19标签';
comment on column lot_validation.lot20_label is '批属性20标签';
comment on column lot_validation.add_id is '记录人';
comment on column lot_validation.add_name is '记录人姓名';
comment on column lot_validation.add_date is '记录时间';
comment on column lot_validation.edit_id is '编辑人';
comment on column lot_validation.edit_name is '编辑人姓名';
comment on column lot_validation.edit_date is '编辑时间';

create table lotattribute
(
	row_id						varchar2(32) not null,
	owner_id       				varchar2(30) not null,
	sku       					varchar2(30) not null,
	lot 						varchar2(20) not null,
	lot01 						varchar2(30) default ' ' not null,
	lot02 						varchar2(30) default ' ' not null,
	lot03 						varchar2(30) default ' ' not null,
	lot04 						varchar2(30) default ' ' not null,
	lot05 						varchar2(30) default ' ' not null,
	lot06 						varchar2(30) default ' ' not null,
	lot07 						varchar2(30) default ' ' not null,
	lot08 						varchar2(30) default ' ' not null,
	lot09 						varchar2(30) default ' ' not null,
	lot10 						varchar2(30) default ' ' not null,
	lot11 						varchar2(30) default ' ' not null,
	lot12 						varchar2(30) default ' ' not null,
	lot13 						varchar2(30) default ' ' not null,
	lot14 						varchar2(30) default ' ' not null,
	lot15 						date,
	lot16 						date,
	lot17 						date,
	lot18 						date,
	lot19 						date,
	lot20 						date,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table lotattribute add constraint pk_lotattribute primary key (row_id) using index;
create unique index uidx_lotattribute on lotattribute (lot);
comment on table lotattribute is '批属性';
comment on column lotattribute.row_id is 'uuid主键';
comment on column lotattribute.owner_id is '货主';
comment on column lotattribute.sku is '货品';
comment on column lotattribute.lot is '批次';
comment on column lotattribute.lot01 is '批属性01';
comment on column lotattribute.lot02 is '批属性02';
comment on column lotattribute.lot03 is '批属性03';
comment on column lotattribute.lot04 is '批属性04';
comment on column lotattribute.lot05 is '批属性05';
comment on column lotattribute.lot06 is '批属性06';
comment on column lotattribute.lot07 is '批属性07';
comment on column lotattribute.lot08 is '批属性08';
comment on column lotattribute.lot09 is '批属性09';
comment on column lotattribute.lot10 is '批属性10';
comment on column lotattribute.lot11 is '批属性11';
comment on column lotattribute.lot12 is '批属性12';
comment on column lotattribute.lot13 is '批属性13';
comment on column lotattribute.lot14 is '批属性14';
comment on column lotattribute.lot15 is '批属性15';
comment on column lotattribute.lot16 is '批属性16';
comment on column lotattribute.lot17 is '批属性17';
comment on column lotattribute.lot18 is '批属性18';
comment on column lotattribute.lot19 is '批属性19';
comment on column lotattribute.lot20 is '批属性20';
comment on column lotattribute.udf1 is '用户自定义1';
comment on column lotattribute.udf2 is '用户自定义2';
comment on column lotattribute.udf3 is '用户自定义3';
comment on column lotattribute.udf4 is '用户自定义4';
comment on column lotattribute.udf5 is '用户自定义5';
comment on column lotattribute.notes is '备注';
comment on column lotattribute.add_id is '记录人';
comment on column lotattribute.add_name is '记录人姓名';
comment on column lotattribute.add_date is '记录时间';

create table inventory
(
	row_id						varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	lot 						varchar2(20) not null,
	owner_id       				varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	loc_id 						varchar2(30) not null,
	container_id 				varchar2(30) default ' ' not null,
	pack_qty  					number(22,5) not null,
	packs 						number(22,5) not null,
	qty 						number(22,5) not null,
	qty_allocated 				number(22,5) default 0 not null,
	qty_putaway 				number(22,5) default 0 not null,
	qty_hold 					number(22,5) default 0 not null,
	hold_user_id 				varchar2(20),
	hold_user_name 				nvarchar2(20),
	inventory_sequence 			number default 0 not null,
	outbound_priority 			number default 1 not null,
	status						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table inventory add constraint pk_inventory primary key (row_id) using index;
create unique index uidx_inventory on inventory (rdc_id,lot,loc_id,container_id);
comment on table inventory is '库存表';
comment on column inventory.row_id is 'uuid主键';
comment on column inventory.rdc_id is '物流中心';
comment on column inventory.lot is '批次';
comment on column inventory.owner_id is '货主';
comment on column inventory.sku is '货品';
comment on column inventory.sku_descr is '货品描述';
comment on column inventory.loc_id is '库位';
comment on column inventory.container_id is '容器';
comment on column inventory.pack_qty is '实际主包装含量';
comment on column inventory.packs is '包装数量';
comment on column inventory.qty is '数量';
comment on column inventory.qty_allocated is '分配量';
comment on column inventory.qty_putaway is '待上架量';
comment on column inventory.qty_hold is '冻结量';
comment on column inventory.hold_user_id is '冻结人';
comment on column inventory.hold_user_name is '冻结人姓名';
comment on column inventory.inventory_sequence is '库存顺序号';
comment on column inventory.outbound_priority is '出库优先级';
comment on column inventory.status is '状态';
comment on column inventory.udf1 is '用户自定义1';
comment on column inventory.udf2 is '用户自定义2';
comment on column inventory.udf3 is '用户自定义3';
comment on column inventory.add_id is '记录人';
comment on column inventory.add_name is '记录人姓名';
comment on column inventory.add_date is '记录时间';
comment on column inventory.edit_id is '编辑人';
comment on column inventory.edit_name is '编辑人姓名';
comment on column inventory.edit_date is '编辑时间';

create table inventory_sn
(
	row_id						varchar2(32) not null,
	inventory_row_id 			varchar2(32) not null,
	rdc_id						varchar2(30) not null,
	serial_number 				varchar2(30) not null,
	status						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table inventory_sn add constraint pk_inventory_sn primary key (row_id) using index;
create index idx_inventory_sn_i on inventory_sn (inventory_row_id);
create unique index uidx_inventory_sn on inventory_sn (serial_number);
comment on table inventory_sn is '库存唯一码';
comment on column inventory_sn.row_id is 'uuid主键';
comment on column inventory_sn.inventory_row_id is '库存uuid';
comment on column inventory_sn.rdc_id is '物流中心';
comment on column inventory_sn.serial_number is 'sn号';
comment on column inventory_sn.status is '状态';
comment on column inventory_sn.udf1 is '用户自定义1';
comment on column inventory_sn.udf2 is '用户自定义2';
comment on column inventory_sn.udf3 is '用户自定义3';
comment on column inventory_sn.add_id is '记录人';
comment on column inventory_sn.add_name is '记录人姓名';
comment on column inventory_sn.add_date is '记录时间';

create table sn_log
(
	row_id						varchar2(32) not null,
	related_row_id				varchar2(32),
	rdc_id						varchar2(30) not null,
	operation_type 				nvarchar2(20) not null,
	serial_number 				varchar2(30) not null,
	status						varchar2(10) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table sn_log add constraint pk_sn_log primary key (row_id) using index;
create index idx_sn_log_r on sn_log (related_row_id);
comment on table sn_log is '唯一码操作日志';
comment on column sn_log.row_id is 'uuid主键';
comment on column sn_log.related_row_id is '关联表的row_id';
comment on column sn_log.rdc_id is '物流中心';
comment on column sn_log.operation_type is '操作类型:入库/移动/库存调整/出库';
comment on column sn_log.serial_number is 'sn号';
comment on column sn_log.status is '状态';
comment on column sn_log.udf1 is '用户自定义1';
comment on column sn_log.udf2 is '用户自定义2';
comment on column sn_log.udf3 is '用户自定义3';
comment on column sn_log.add_id is '记录人';
comment on column sn_log.add_name is '记录人姓名';
comment on column sn_log.add_date is '记录时间';

create table putaway_strategy
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	putaway_strategy_id 		varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table putaway_strategy add constraint pk_putaway_strategy primary key (row_id) using index;
create unique index uidx_putaway_strategy on putaway_strategy (rdc_id,putaway_strategy_id);
comment on table putaway_strategy is '上架策略';
comment on column putaway_strategy.row_id is 'uuid主键';
comment on column putaway_strategy.rdc_id is '物流中心';
comment on column putaway_strategy.putaway_strategy_id is '上架策略编码';
comment on column putaway_strategy.descr is '策略描述';
comment on column putaway_strategy.udf1 is '用户自定义1';
comment on column putaway_strategy.udf2 is '用户自定义2';
comment on column putaway_strategy.udf3 is '用户自定义3';
comment on column putaway_strategy.add_id is '记录人';
comment on column putaway_strategy.add_name is '记录人姓名';
comment on column putaway_strategy.add_date is '记录时间';
comment on column putaway_strategy.edit_id is '编辑人';
comment on column putaway_strategy.edit_name is '编辑人姓名';
comment on column putaway_strategy.edit_date is '编辑时间';

create table putaway_strategy_detail
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	putaway_strategy_id 		varchar2(30) not null,
	step_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	warehouse_id 				varchar2(30) not null,
	from_loc 					varchar2(30),
	to_loc 						varchar2(30),
	pick_loc 	 				nvarchar2(1) default '否' not null,
	dimension_restrictions1   	varchar2(20),
	dimension_restrictions2   	varchar2(20),
	dimension_restrictions3   	varchar2(20),
	dimension_restrictions4   	varchar2(20),
	dimension_restrictions5   	varchar2(20),
	region_id1 					varchar2(30),
	region_id2 					varchar2(30),
	region_id3 					varchar2(30),
	exclude_region_id1 			varchar2(30),
	exclude_region_id2 			varchar2(30),
	exclude_region_id3 			varchar2(30),
	area_id1 					varchar2(30),
	area_id2 					varchar2(30),
	area_id3 					varchar2(30),
	exclude_area_id1 			varchar2(30),
	exclude_area_id2 			varchar2(30),
	exclude_area_id3  			varchar2(30),
	loc_type1 					varchar2(30),
	loc_type2 					varchar2(30),
	loc_type3 					varchar2(30),
	loc_type4 					varchar2(30),
	loc_type5 					varchar2(30),
	exclude_loc_type1   		varchar2(30),
	exclude_loc_type2   		varchar2(30),
	exclude_loc_type3   		varchar2(30),
	exclude_loc_type4   		varchar2(30),
	exclude_loc_type5   		varchar2(30),
	shelves_type1				varchar2(30),
	shelves_type2				varchar2(30),
	shelves_type3				varchar2(30),
	shelves_type4				varchar2(30),
	shelves_type5				varchar2(30),
	exclude_shelves_type1		varchar2(30),
	exclude_shelves_type2		varchar2(30),
	exclude_shelves_type3		varchar2(30),
	exclude_shelves_type4		varchar2(30),
	exclude_shelves_type5		varchar2(30),
	type_id1					varchar2(30),
	type_id2					varchar2(30),
	type_id3					varchar2(30),
	type_id4					varchar2(30),
	type_id5					varchar2(30),
	loc_status1 				varchar2(10),
	loc_status2 			 	varchar2(10),
	loc_status3 				varchar2(10),
	exclude_loc_status1 		varchar2(10),
	exclude_loc_status2 		varchar2(10),
	exclude_loc_status3  		varchar2(10),
	sku_abc1 					varchar2(10),
	sku_abc2 					varchar2(10),
	sku_abc3 					varchar2(10),
	loc_abc1 					varchar2(10),
	loc_abc2 					varchar2(10),
	loc_abc3 					varchar2(10),
	sku_sort1 					varchar2(20),
	sku_sort2 					varchar2(20),
	sku_sort3 					varchar2(20),
	exclude_sku_sort1 			varchar2(20),
	exclude_sku_sort2 			varchar2(20),
	exclude_sku_sort3 			varchar2(20),
	sku_group1 					varchar2(20),
	sku_group2 					varchar2(20),
	sku_group3 					varchar2(20),
	exclude_sku_group1 			varchar2(20),
	exclude_sku_group2 			varchar2(20),
	exclude_sku_group3 			varchar2(20),
	nearby_store 				nvarchar2(1) default '否' not null,
	max_lot  					number default 0 not null,
	max_sku 					number default 0 not null,
	area_max_loc 				number default 0 not null,
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table putaway_strategy_detail add constraint pk_putaway_strategy_detail primary key (row_id) using index;
create unique index uidx_ps_detail on putaway_strategy_detail (rdc_id,putaway_strategy_id,step_id);
comment on table putaway_strategy_detail is '上架策略明细	';
comment on column putaway_strategy_detail.row_id is 'uuid主键';
comment on column putaway_strategy_detail.rdc_id is '物流中心';
comment on column putaway_strategy_detail.putaway_strategy_id is '上架策略';
comment on column putaway_strategy_detail.step_id is '上架步骤';
comment on column putaway_strategy_detail.descr is '策略行描述';
comment on column putaway_strategy_detail.warehouse_id is '上架仓库';
comment on column putaway_strategy_detail.from_loc is '从库位';
comment on column putaway_strategy_detail.to_loc is '如果从from_to库位开始上架时直接上架到该库位';
comment on column putaway_strategy_detail.pick_loc is '是否拣货库位';
comment on column putaway_strategy_detail.dimension_restrictions1 is '空间限制1';
comment on column putaway_strategy_detail.dimension_restrictions2 is '空间限制2';
comment on column putaway_strategy_detail.dimension_restrictions3 is '空间限制3';
comment on column putaway_strategy_detail.dimension_restrictions4 is '空间限制4';
comment on column putaway_strategy_detail.dimension_restrictions5 is '空间限制5';
comment on column putaway_strategy_detail.region_id1 is '上架到区域1';
comment on column putaway_strategy_detail.region_id2 is '上架到区域2';
comment on column putaway_strategy_detail.region_id3 is '上架到区域3';
comment on column putaway_strategy_detail.exclude_region_id1 is '排除区域1';
comment on column putaway_strategy_detail.exclude_region_id2 is '排除区域2';
comment on column putaway_strategy_detail.exclude_region_id3 is '排除区域3';
comment on column putaway_strategy_detail.area_id1 is '上架到库区1';
comment on column putaway_strategy_detail.area_id2 is '上架到库区2';
comment on column putaway_strategy_detail.area_id3 is '上架到库区3';
comment on column putaway_strategy_detail.exclude_area_id1 is '排除库区1';
comment on column putaway_strategy_detail.exclude_area_id2 is '排除库区2';
comment on column putaway_strategy_detail.exclude_area_id3 is '排除库区3';
comment on column putaway_strategy_detail.loc_type1 is '库位类型1';
comment on column putaway_strategy_detail.loc_type2 is '库位类型2';
comment on column putaway_strategy_detail.loc_type3 is '库位类型3';
comment on column putaway_strategy_detail.loc_type4 is '库位类型4';
comment on column putaway_strategy_detail.loc_type5 is '库位类型5';
comment on column putaway_strategy_detail.exclude_loc_type1 is '排除库位类型1';
comment on column putaway_strategy_detail.exclude_loc_type2 is '排除库位类型2';
comment on column putaway_strategy_detail.exclude_loc_type3 is '排除库位类型3';
comment on column putaway_strategy_detail.exclude_loc_type4 is '排除库位类型4';
comment on column putaway_strategy_detail.exclude_loc_type5 is '排除库位类型5';
comment on column putaway_strategy_detail.shelves_type1 is '货架类型1';
comment on column putaway_strategy_detail.shelves_type2 is '货架类型2';
comment on column putaway_strategy_detail.shelves_type3 is '货架类型3';
comment on column putaway_strategy_detail.shelves_type4 is '货架类型4';
comment on column putaway_strategy_detail.shelves_type5 is '货架类型5';
comment on column putaway_strategy_detail.exclude_shelves_type1 is '排除货架类型1';
comment on column putaway_strategy_detail.exclude_shelves_type2 is '排除货架类型2';
comment on column putaway_strategy_detail.exclude_shelves_type3 is '排除货架类型3';
comment on column putaway_strategy_detail.exclude_shelves_type4 is '排除货架类型4';
comment on column putaway_strategy_detail.exclude_shelves_type5 is '排除货架类型5';
comment on column putaway_strategy_detail.type_id1 is '单据类型1';
comment on column putaway_strategy_detail.type_id2 is '单据类型2';
comment on column putaway_strategy_detail.type_id3 is '单据类型3';
comment on column putaway_strategy_detail.type_id4 is '单据类型4';
comment on column putaway_strategy_detail.type_id5 is '单据类型5';
comment on column putaway_strategy_detail.loc_status1 is '库位状态1';
comment on column putaway_strategy_detail.loc_status2 is '库位状态2';
comment on column putaway_strategy_detail.loc_status3 is '库位状态3';
comment on column putaway_strategy_detail.exclude_loc_status1 is '排除库位状态1';
comment on column putaway_strategy_detail.exclude_loc_status2 is '排除库位状态2';
comment on column putaway_strategy_detail.exclude_loc_status3 is '排除库位状态3';
comment on column putaway_strategy_detail.sku_abc1 is '货品ABC1';
comment on column putaway_strategy_detail.sku_abc2 is '货品ABC2';
comment on column putaway_strategy_detail.sku_abc3 is '货品ABC3';
comment on column putaway_strategy_detail.loc_abc1 is '库位ABC1';
comment on column putaway_strategy_detail.loc_abc2 is '库位ABC2';
comment on column putaway_strategy_detail.loc_abc3 is '库位ABC3';
comment on column putaway_strategy_detail.sku_sort1 is '货品分类1';
comment on column putaway_strategy_detail.sku_sort2 is '货品分类2';
comment on column putaway_strategy_detail.sku_sort3 is '货品分类3';
comment on column putaway_strategy_detail.exclude_sku_sort1 is '排除货品分类1';
comment on column putaway_strategy_detail.exclude_sku_sort2 is '排除货品分类2';
comment on column putaway_strategy_detail.exclude_sku_sort3 is '排除货品分类3';
comment on column putaway_strategy_detail.sku_group1 is '货品组1';
comment on column putaway_strategy_detail.sku_group2 is '货品组2';
comment on column putaway_strategy_detail.sku_group3 is '货品组3';
comment on column putaway_strategy_detail.exclude_sku_group1 is '排除货品组1';
comment on column putaway_strategy_detail.exclude_sku_group2 is '排除货品组2';
comment on column putaway_strategy_detail.exclude_sku_group3 is '排除货品组3';
comment on column putaway_strategy_detail.nearby_store is '是否和同货品就近存储';
comment on column putaway_strategy_detail.max_lot is '上架库位最大批次数';
comment on column putaway_strategy_detail.max_sku is '上架库位最大货品数';
comment on column putaway_strategy_detail.area_max_loc is '上架库区该货品占用的最大库位数';
comment on column putaway_strategy_detail.add_id is '记录人';
comment on column putaway_strategy_detail.add_name is '记录人姓名';
comment on column putaway_strategy_detail.add_date is '记录时间';
comment on column putaway_strategy_detail.edit_id is '编辑人';
comment on column putaway_strategy_detail.edit_name is '编辑人姓名';
comment on column putaway_strategy_detail.edit_date is '编辑时间';

create table allocate_strategy
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	allocate_strategy_id 		varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table allocate_strategy add constraint pk_allocate_strategy primary key (row_id) using index;
create unique index uidx_allocate_strategy on allocate_strategy (rdc_id,allocate_strategy_id);
comment on table allocate_strategy is '分配策略';
comment on column allocate_strategy.row_id is 'uuid主键';
comment on column allocate_strategy.rdc_id is '物流中心';
comment on column allocate_strategy.allocate_strategy_id is '分配策略编码';
comment on column allocate_strategy.descr is '策略描述';
comment on column allocate_strategy.udf1 is '用户自定义1';
comment on column allocate_strategy.udf2 is '用户自定义2';
comment on column allocate_strategy.udf3 is '用户自定义3';
comment on column allocate_strategy.add_id is '记录人';
comment on column allocate_strategy.add_name is '记录人姓名';
comment on column allocate_strategy.add_date is '记录时间';
comment on column allocate_strategy.edit_id is '编辑人';
comment on column allocate_strategy.edit_name is '编辑人姓名';
comment on column allocate_strategy.edit_date is '编辑时间';

create table allocate_strategy_detail
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	allocate_strategy_id 		varchar2(30) not null,
	line_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	uom 						varchar2(30) not null,
	shelves_type 				varchar2(30),
	loc_type                 	varchar2(30),
	region_id					varchar2(30),
	area_id 					varchar2(30),
	loc_id 						varchar2(30),
	store_picking 				nvarchar2(1) default '否' not null,
	over_allocation				nvarchar2(1) default '否' not null,
	clear_loc					nvarchar2(1) default '否' not null,
	create_replenishment 		nvarchar2(1) default '否' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table allocate_strategy_detail add constraint pk_allocate_strategy_detail primary key (row_id) using index;
create unique index uidx_as_detail on allocate_strategy_detail (rdc_id,allocate_strategy_id,line_id);
comment on table allocate_strategy_detail is '分配策略明细';
comment on column allocate_strategy_detail.row_id is 'uuid主键';
comment on column allocate_strategy_detail.rdc_id is '物流中心';
comment on column allocate_strategy_detail.allocate_strategy_id is '分配策略编码';
comment on column allocate_strategy_detail.line_id is '行号';
comment on column allocate_strategy_detail.descr is '策略行描述';
comment on column allocate_strategy_detail.uom is '单位';
comment on column allocate_strategy_detail.shelves_type is '货架类型 密集库 自动库 高位货架 平面拆零 搁板拆零 电子标签';
comment on column allocate_strategy_detail.loc_type is '库位类型 CS:整箱存储 EA:拆零存储 PL:整托存储 NONE:不限 DOCK:集货';
comment on column allocate_strategy_detail.region_id is '区域编码';
comment on column allocate_strategy_detail.area_id is '库区编码';
comment on column allocate_strategy_detail.loc_id is '库位';
comment on column allocate_strategy_detail.store_picking is '是否允许存储位拣货';
comment on column allocate_strategy_detail.over_allocation is '是否允许超额分配';
comment on column allocate_strategy_detail.clear_loc is '是否清除库位优先';
comment on column allocate_strategy_detail.create_replenishment is '是否允许创建补货任务';
comment on column allocate_strategy_detail.udf1 is '用户自定义1';
comment on column allocate_strategy_detail.udf2 is '用户自定义2';
comment on column allocate_strategy_detail.udf3 is '用户自定义3';
comment on column allocate_strategy_detail.add_id is '记录人';
comment on column allocate_strategy_detail.add_name is '记录人姓名';
comment on column allocate_strategy_detail.add_date is '记录时间';
comment on column allocate_strategy_detail.edit_id is '编辑人';
comment on column allocate_strategy_detail.edit_name is '编辑人姓名';
comment on column allocate_strategy_detail.edit_date is '编辑时间';

create table orders_sequence
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	orders_sequence_id 			varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	sequence_type 				nvarchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table orders_sequence add constraint pk_orders_sequence primary key (row_id) using index;
create unique index uidx_orders_sequence on orders_sequence (rdc_id,orders_sequence_id);
comment on table orders_sequence is '订单顺序策略';
comment on column orders_sequence.row_id is 'uuid主键';
comment on column orders_sequence.rdc_id is '物流中心';
comment on column orders_sequence.orders_sequence_id is '订单顺序策略编码';
comment on column orders_sequence.descr is '订单顺序策略描述';
comment on column orders_sequence.sequence_type is '排序方式:订单优先级/客户优先级/配送路序';
comment on column orders_sequence.udf1 is '用户自定义1';
comment on column orders_sequence.udf2 is '用户自定义2';
comment on column orders_sequence.udf3 is '用户自定义3';
comment on column orders_sequence.add_id is '记录人';
comment on column orders_sequence.add_name is '记录人姓名';
comment on column orders_sequence.add_date is '记录时间';
comment on column orders_sequence.edit_id is '编辑人';
comment on column orders_sequence.edit_name is '编辑人姓名';
comment on column orders_sequence.edit_date is '编辑时间';

--priority 存的lotN
create table inventory_rotation
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	rotation_id 				varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	priority01 					varchar2(20),
	sorting01 					nvarchar2(2) default '正序' not null,
	priority02 					varchar2(20),
	sorting02 					nvarchar2(2) default '正序' not null,
	priority03 					varchar2(20),
	sorting03 					nvarchar2(2) default '正序' not null,
	priority04 					varchar2(20),
	sorting04 					nvarchar2(2) default '正序' not null,
	priority05 					varchar2(20),
	sorting05 					nvarchar2(2) default '正序' not null,
	priority06 					varchar2(20),
	sorting06 					nvarchar2(2) default '正序' not null,
	priority07 					varchar2(20),
	sorting07 					nvarchar2(2) default '正序' not null,
	priority08 					varchar2(20),
	sorting08 					nvarchar2(2) default '正序' not null,
	priority09 					varchar2(20),
	sorting09 					nvarchar2(2) default '正序' not null,
	priority10 					varchar2(20),
	sorting10 					nvarchar2(2) default '正序' not null,
	priority11 					varchar2(20),
	sorting11 					nvarchar2(2) default '正序' not null,
	priority12 					varchar2(20),
	sorting12 					nvarchar2(2) default '正序' not null,
	priority13 					varchar2(20),
	sorting13 					nvarchar2(2) default '正序' not null,
	priority14 					varchar2(20),
	sorting14 					nvarchar2(2) default '正序' not null,
	priority15 					varchar2(20),
	sorting15 					nvarchar2(2) default '正序' not null,
	priority16 					varchar2(20),
	sorting16 					nvarchar2(2) default '正序' not null,
	priority17 					varchar2(20),
	sorting17 					nvarchar2(2) default '正序' not null,
	priority18 					varchar2(20),
	sorting18 					nvarchar2(2) default '正序' not null,
	priority19 					varchar2(20),
	sorting19 					nvarchar2(2) default '正序' not null,
	priority20 					varchar2(20),
	sorting20 					nvarchar2(2) default '正序' not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table inventory_rotation add constraint pk_inventory_rotation primary key (row_id) using index;
create unique index uidx_inventory_rotation on inventory_rotation (rdc_id,rotation_id);
comment on table inventory_rotation is '库存周转规则';
comment on column inventory_rotation.row_id is 'uuid主键';
comment on column inventory_rotation.rdc_id is '物流中心';
comment on column inventory_rotation.rotation_id is '周转规则编码';
comment on column inventory_rotation.descr is '周转规则描述';
comment on column inventory_rotation.priority01 is '优先级01的批属性';
comment on column inventory_rotation.sorting01 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority02 is '优先级02的批属性';
comment on column inventory_rotation.sorting02 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority03 is '优先级03的批属性';
comment on column inventory_rotation.sorting03 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority04 is '优先级04的批属性';
comment on column inventory_rotation.sorting04 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority05 is '优先级05的批属性';
comment on column inventory_rotation.sorting05 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority06 is '优先级06的批属性';
comment on column inventory_rotation.sorting06 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority07 is '优先级07的批属性';
comment on column inventory_rotation.sorting07 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority08 is '优先级08的批属性';
comment on column inventory_rotation.sorting08 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority09 is '优先级09的批属性';
comment on column inventory_rotation.sorting09 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority10 is '优先级10的批属性';
comment on column inventory_rotation.sorting10 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority11 is '优先级11的批属性';
comment on column inventory_rotation.sorting11 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority12 is '优先级12的批属性';
comment on column inventory_rotation.sorting12 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority13 is '优先级13的批属性';
comment on column inventory_rotation.sorting13 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority14 is '优先级14的批属性';
comment on column inventory_rotation.sorting14 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority15 is '优先级15的批属性';
comment on column inventory_rotation.sorting15 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority16 is '优先级16的批属性';
comment on column inventory_rotation.sorting16 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority17 is '优先级17的批属性';
comment on column inventory_rotation.sorting17 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority18 is '优先级18的批属性';
comment on column inventory_rotation.sorting18 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority19 is '优先级19的批属性';
comment on column inventory_rotation.sorting19 is '排序方式:正序/倒序';
comment on column inventory_rotation.priority20 is '优先级20的批属性';
comment on column inventory_rotation.sorting20 is '排序方式:正序/倒序';
comment on column inventory_rotation.udf1 is '用户自定义1';
comment on column inventory_rotation.udf2 is '用户自定义2';
comment on column inventory_rotation.udf3 is '用户自定义3';
comment on column inventory_rotation.add_id is '记录人';
comment on column inventory_rotation.add_name is '记录人姓名';
comment on column inventory_rotation.add_date is '记录时间';
comment on column inventory_rotation.edit_id is '编辑人';
comment on column inventory_rotation.edit_name is '编辑人姓名';
comment on column inventory_rotation.edit_date is '编辑时间';

create table inventory_hold_code
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	hold_id 					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table inventory_hold_code add constraint pk_inventory_hold_code primary key (row_id) using index;
create unique index uidx_inventory_hold_code on inventory_hold_code (rdc_id,hold_id);
comment on table inventory_hold_code is '库存冻结编码';
comment on column inventory_hold_code.row_id is 'uuid主键';
comment on column inventory_hold_code.rdc_id is '物流中心';
comment on column inventory_hold_code.hold_id is '冻结编码';
comment on column inventory_hold_code.descr is '冻结描述';
comment on column inventory_hold_code.udf1 is '用户自定义1';
comment on column inventory_hold_code.udf2 is '用户自定义2';
comment on column inventory_hold_code.udf3 is '用户自定义3';
comment on column inventory_hold_code.add_id is '记录人';
comment on column inventory_hold_code.add_name is '记录人姓名';
comment on column inventory_hold_code.add_date is '记录时间';
comment on column inventory_hold_code.edit_id is '编辑人';
comment on column inventory_hold_code.edit_name is '编辑人姓名';
comment on column inventory_hold_code.edit_date is '编辑时间';

create table inventory_hold
(
	row_id						varchar2(32) not null,
	inventory_row_id            varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	owner_id 					varchar2(30) not null,
	sku       					varchar2(30) not null,
	sku_descr 					nvarchar2(60) not null,
	lot 						varchar2(20) not null,
	loc_id  					varchar2(30) not null,
	container_id  				varchar2(30) default ' ' not null,
	hold_id 					varchar2(30) not null,
	unhold_user_id 				varchar2(20),
	unhold_user_name			nvarchar2(20),
	unhold_date					date,
	status 						varchar2(10),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table inventory_hold add constraint pk_inventory_hold primary key (row_id) using index;
create index idx_inventory_hold_i on inventory_hold (inventory_row_id);
comment on table inventory_hold is '库存冻结';
comment on column inventory_hold.row_id is 'uuid主键';
comment on column inventory_hold.inventory_row_id is '库存uuid';
comment on column inventory_hold.rdc_id is '物流中心';
comment on column inventory_hold.owner_id is '货主';
comment on column inventory_hold.sku is '货品';
comment on column inventory_hold.sku_descr is '货品描述';
comment on column inventory_hold.lot is '批次';
comment on column inventory_hold.loc_id is '库位';
comment on column inventory_hold.container_id is '容器';
comment on column inventory_hold.hold_id is '冻结编码';
comment on column inventory_hold.unhold_user_id is '解冻人';
comment on column inventory_hold.unhold_user_name is '解冻人姓名';
comment on column inventory_hold.unhold_date is '解冻日期';
comment on column inventory_hold.status is '状态';
comment on column inventory_hold.udf1 is '用户自定义1';
comment on column inventory_hold.udf2 is '用户自定义2';
comment on column inventory_hold.udf3 is '用户自定义3';
comment on column inventory_hold.add_id is '记录人';
comment on column inventory_hold.add_name is '记录人姓名';
comment on column inventory_hold.add_date is '记录时间';

create table data_modify_log
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	voucher_id 					varchar2(30) not null,
	line_id 					varchar2(30),
	data_source 				nvarchar2(30) not null,
	data_label01  				nvarchar2(30),
	before_data01 				varchar2(60),
	after_data01 				varchar2(60),
	data_label02				nvarchar2(30),
	before_data02 				varchar2(60),
	after_data02 				varchar2(60),
	data_label03				 nvarchar2(30),	
	before_data03 				varchar2(60),
	after_data03 				varchar2(60),
	data_label04				nvarchar2(30) not null,
	before_data04 				varchar2(60),
	after_data04 				varchar2(60),
	data_label05 				nvarchar2(30) not null,
	before_data05 				varchar2(60),
	after_data05 				varchar2(60),
	data_label06 				nvarchar2(30) not null,
	before_data06 				varchar2(60),
	after_data06 				varchar2(60),
	data_label07 				nvarchar2(30) not null,
	before_data07 				varchar2(60),
	after_data07 				varchar2(60),
	data_label08 				nvarchar2(30) not null,
	before_data08 				varchar2(60),
	after_data08 				varchar2(60),
	data_label09 				nvarchar2(30) not null,
	before_data09 				varchar2(60),
	after_data09 				varchar2(60),
	data_label10 				nvarchar2(30) not null,
	before_data10 				varchar2(60),
	after_data10 				varchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table data_modify_log add constraint pk_data_modify_log primary key (row_id) using index;
comment on table data_modify_log is '数据修改日志	';
comment on column data_modify_log.row_id is 'uuid主键';
comment on column data_modify_log.rdc_id is '物流中心';
comment on column data_modify_log.voucher_id is '单据号';
comment on column data_modify_log.line_id is '行号';
comment on column data_modify_log.data_source is '数据来源';
comment on column data_modify_log.data_label01 is '数据标签01';
comment on column data_modify_log.before_data01 is '修改前数据01';
comment on column data_modify_log.after_data01 is '修改后数据01';
comment on column data_modify_log.data_label02 is '数据标签02';
comment on column data_modify_log.before_data02 is '修改前数据02';
comment on column data_modify_log.after_data02 is '修改后数据02';
comment on column data_modify_log.data_label03 is '数据标签03';
comment on column data_modify_log.before_data03 is '修改前数据03';
comment on column data_modify_log.after_data03 is '修改后数据03';
comment on column data_modify_log.data_label04 is '数据标签04';
comment on column data_modify_log.before_data04 is '修改前数据04';
comment on column data_modify_log.after_data04 is '修改后数据04';
comment on column data_modify_log.data_label05 is '数据标签05';
comment on column data_modify_log.before_data05 is '修改前数据05';
comment on column data_modify_log.after_data05 is '修改后数据05';
comment on column data_modify_log.data_label06 is '数据标签06';
comment on column data_modify_log.before_data06 is '修改前数据06';
comment on column data_modify_log.after_data06 is '修改后数据06';
comment on column data_modify_log.data_label07 is '数据标签07';
comment on column data_modify_log.before_data07 is '修改前数据07';
comment on column data_modify_log.after_data07 is '修改后数据07';
comment on column data_modify_log.data_label08 is '数据标签08';
comment on column data_modify_log.before_data08 is '修改前数据08';
comment on column data_modify_log.after_data08 is '修改后数据08';
comment on column data_modify_log.data_label09 is '数据标签09';
comment on column data_modify_log.before_data09 is '修改前数据09';
comment on column data_modify_log.after_data09 is '修改后数据09';
comment on column data_modify_log.data_label10 is '数据标签10';
comment on column data_modify_log.before_data10 is '修改前数据10';
comment on column data_modify_log.after_data10 is '修改后数据10';
comment on column data_modify_log.add_id is '记录人';
comment on column data_modify_log.add_name is '记录人姓名';
comment on column data_modify_log.add_date is '记录时间';

create table operation_log
(
	row_id						varchar2(32) not null,
	source_row_id 				varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	log_type 					varchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
    udf5         				varchar2(50),
	notes						nvarchar2(60),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate
);
alter table operation_log add constraint pk_operation_log primary key (row_id) using index;
create index idx_operation_log_s on operation_log (source_row_id);
comment on table operation_log is '操作日志';
comment on column operation_log.row_id is 'uuid主键';
comment on column operation_log.source_row_id is '库存uuid';
comment on column operation_log.rdc_id is '物流中心';
comment on column operation_log.log_type is '日志类型';
comment on column operation_log.udf1 is '用户自定义1';
comment on column operation_log.udf2 is '用户自定义2';
comment on column operation_log.udf3 is '用户自定义3';
comment on column operation_log.udf4 is '用户自定义4';
comment on column operation_log.udf5 is '用户自定义5';
comment on column operation_log.add_id is '记录人';
comment on column operation_log.add_name is '记录人姓名';
comment on column operation_log.add_date is '记录时间';

--接口中间表：
create table sku_brand
(
	row_id						varchar2(32) not null,
	brand_id					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table sku_brand add constraint pk_sku_brand primary key (row_id) using index;
create unique index uidx_sku_brand on sku_brand (brand_id);
comment on table sku_brand is '品牌';
comment on column sku_brand.row_id is 'uuid主键';
comment on column sku_brand.brand_id is '品牌编码';
comment on column sku_brand.descr is '品牌描述';
comment on column sku_brand.udf1 is '用户自定义1';
comment on column sku_brand.udf2 is '用户自定义2';
comment on column sku_brand.udf3 is '用户自定义3';
comment on column sku_brand.udf4 is '用户自定义4';
comment on column sku_brand.udf5 is '用户自定义5';
comment on column sku_brand.add_id is '记录人';
comment on column sku_brand.add_name is '记录人姓名';
comment on column sku_brand.add_date is '记录时间';
comment on column sku_brand.edit_id is '编辑人';
comment on column sku_brand.edit_name is '编辑人姓名';
comment on column sku_brand.edit_date is '编辑时间';

create table sku_price
(
	row_id						varchar2(32) not null,
	owner_id					varchar2(30) not null,
	sku 						varchar2(30) not null,
	u_price                  	number(22,5) default 0 not null,
	in_price 					number(22,5) default 0 not null,
	rate 						varchar2(30),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table sku_price add constraint pk_sku_price primary key (row_id) using index;
create unique index uidx_sku_price on sku_price (owner_id);
comment on table sku_price is '价格';
comment on column sku_price.row_id is 'uuid主键';
comment on column sku_price.owner_id is '批发公司部门';
comment on column sku_price.sku is '商品编码';
comment on column sku_price.u_price is '未税价格';
comment on column sku_price.in_price is '含税价格';
comment on column sku_price.rate is '税率';
comment on column sku_price.udf1 is '用户自定义1';
comment on column sku_price.udf2 is '用户自定义2';
comment on column sku_price.udf3 is '用户自定义3';
comment on column sku_price.udf4 is '用户自定义4';
comment on column sku_price.udf5 is '用户自定义5';
comment on column sku_price.add_id is '记录人';
comment on column sku_price.add_name is '记录人姓名';
comment on column sku_price.add_date is '记录时间';
comment on column sku_price.edit_id is '编辑人';
comment on column sku_price.edit_name is '编辑人姓名';
comment on column sku_price.edit_date is '编辑时间';

create table mid_store
(
	row_id						varchar2(32) not null,
	store_id					varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table mid_store add constraint pk_mid_store primary key (row_id) using index;
create unique index uidx_mid_store on mid_store (store_id);
comment on table mid_store is '门店';
comment on column mid_store.row_id is 'uuid主键';
comment on column mid_store.store_id is '门店编码';
comment on column mid_store.descr is '门店名称';
comment on column mid_store.udf1 is '用户自定义1';
comment on column mid_store.udf2 is '用户自定义2';
comment on column mid_store.udf3 is '用户自定义3';
comment on column mid_store.udf4 is '用户自定义4';
comment on column mid_store.udf5 is '用户自定义5';
comment on column mid_store.add_id is '记录人';
comment on column mid_store.add_name is '记录人姓名';
comment on column mid_store.add_date is '记录时间';
comment on column mid_store.edit_id is '编辑人';
comment on column mid_store.edit_name is '编辑人姓名';
comment on column mid_store.edit_date is '编辑时间';

create table mid_deliver_area
(
	row_id						varchar2(32) not null,
	deliver_area_id				varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	flag                  		varchar2(10),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table mid_deliver_area add constraint pk_mid_deliver_area primary key (row_id) using index;
create unique index uidx_mid_deliver_area on mid_deliver_area (deliver_area_id);
comment on table mid_deliver_area is '送货区域';
comment on column mid_deliver_area.row_id is 'uuid主键';
comment on column mid_deliver_area.deliver_area_id is '送货区域编码';
comment on column mid_deliver_area.descr is '区域名称';
comment on column mid_deliver_area.flag is '是否可用';
comment on column mid_deliver_area.udf1 is '用户自定义1';
comment on column mid_deliver_area.udf2 is '用户自定义2';
comment on column mid_deliver_area.udf3 is '用户自定义3';
comment on column mid_deliver_area.udf4 is '用户自定义4';
comment on column mid_deliver_area.udf5 is '用户自定义5';
comment on column mid_deliver_area.add_id is '记录人';
comment on column mid_deliver_area.add_name is '记录人姓名';
comment on column mid_deliver_area.add_date is '记录时间';
comment on column mid_deliver_area.edit_id is '编辑人';
comment on column mid_deliver_area.edit_name is '编辑人姓名';
comment on column mid_deliver_area.edit_date is '编辑时间';

create table mid_pay_type
(
	row_id						varchar2(32) not null,
	pay_id						varchar2(30) not null,
	descr 						nvarchar2(60) not null,
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table mid_pay_type add constraint pk_mid_pay_type primary key (row_id) using index;
create unique index uidx_mid_pay_type on mid_pay_type (pay_id);
comment on table mid_pay_type is '支付方式';
comment on column mid_pay_type.row_id is 'uuid主键';
comment on column mid_pay_type.pay_id is '付款编码';
comment on column mid_pay_type.descr is '付款方式名称';
comment on column mid_pay_type.udf1 is '用户自定义1';
comment on column mid_pay_type.udf2 is '用户自定义2';
comment on column mid_pay_type.udf3 is '用户自定义3';
comment on column mid_pay_type.udf4 is '用户自定义4';
comment on column mid_pay_type.udf5 is '用户自定义5';
comment on column mid_pay_type.add_id is '记录人';
comment on column mid_pay_type.add_name is '记录人姓名';
comment on column mid_pay_type.add_date is '记录时间';
comment on column mid_pay_type.edit_id is '编辑人';
comment on column mid_pay_type.edit_name is '编辑人姓名';
comment on column mid_pay_type.edit_date is '编辑时间';

create table mid_channel
(
	row_id						varchar2(32) not null,
	channel_id				    varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	warehouse_id                varchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table mid_channel add constraint pk_mid_channel primary key (row_id) using index;
create unique index uidx_mid_channel on mid_channel (channel_id);
comment on table mid_channel is '渠道信息';
comment on column mid_channel.row_id is 'uuid主键';
comment on column mid_channel.channel_id is '渠道编码';
comment on column mid_channel.descr is '渠道描述';
comment on column mid_channel.warehouse_id is '仓库';
comment on column mid_channel.udf1 is '用户自定义1';
comment on column mid_channel.udf2 is '用户自定义2';
comment on column mid_channel.udf3 is '用户自定义3';
comment on column mid_channel.udf4 is '用户自定义4';
comment on column mid_channel.udf5 is '用户自定义5';
comment on column mid_channel.add_id is '记录人';
comment on column mid_channel.add_name is '记录人姓名';
comment on column mid_channel.add_date is '记录时间';
comment on column mid_channel.edit_id is '编辑人';
comment on column mid_channel.edit_name is '编辑人姓名';
comment on column mid_channel.edit_date is '编辑时间';

create table cust_o_w_channel
(
	row_id						varchar2(32) not null,
	customer_id					varchar2(30) not null,
	warehouse_id 				varchar2(30) not null,
	owner_id					varchar2(30) not null,
	channel_id                  varchar2(30) not null,
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
    udf4         				varchar2(50),
	udf5         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table cust_o_w_channel add constraint pk_cust_o_w_channel primary key (row_id) using index;
comment on table cust_o_w_channel is '客户/部门/仓库/渠道';
comment on column cust_o_w_channel.row_id is 'uuid主键';
comment on column cust_o_w_channel.customer_id is '客户';
comment on column cust_o_w_channel.warehouse_id is '仓库';
comment on column cust_o_w_channel.owner_id is '部门、货主';
comment on column cust_o_w_channel.channel_id is '渠道';
comment on column cust_o_w_channel.udf1 is '用户自定义1';
comment on column cust_o_w_channel.udf2 is '用户自定义2';
comment on column cust_o_w_channel.udf3 is '用户自定义3';
comment on column cust_o_w_channel.udf4 is '用户自定义4';
comment on column cust_o_w_channel.udf5 is '用户自定义5';
comment on column cust_o_w_channel.add_id is '记录人';
comment on column cust_o_w_channel.add_name is '记录人姓名';
comment on column cust_o_w_channel.add_date is '记录时间';
comment on column cust_o_w_channel.edit_id is '编辑人';
comment on column cust_o_w_channel.edit_name is '编辑人姓名';
comment on column cust_o_w_channel.edit_date is '编辑时间';

create table appliance_transport
(
    row_id                      varchar2(32) not null,
    rdc_id                      varchar2(30) not null,
    appliance_transport_id      varchar2(30) not null,
    plan_delivery_date          date,
    plan_arrive_date            date,
    plan_return_date            date,
    actual_delivery_date        date,
    actual_arrive_date          date,
    actual_return_date          date,
    driver_id                   varchar2(20),
    driver_name                 nvarchar2(20),
    vehicle_number              varchar2(20),
    estimate_mileage            number(22,5),
    start_mileage               number(22,5),
    end_mileage                 number(22,5),
    fee                         number(22,5),
    city_stop_count             number default 0 not null,
    nearby_stop_count           number default 0 not null,
    area_stop_count             number default 0 not null,
    from_stop                   varchar2(30),
    dispatch_id                 varchar2(20),
    dispatch_name               nvarchar2(20),
    porter_id1                  varchar2(20),
    porter_name1                nvarchar2(20),
    porter_id2                  varchar2(20),
    porter_name2                nvarchar2(20),
    porter_id3                  varchar2(20),
    porter_name3                nvarchar2(20),
    recoverable                 nvarchar2(1) default '否' not null,
    recoverable_status          varchar2(10) not null,
    print_count                 number default 0 not null,
    status                      varchar2(10) not null,
    notes                       nvarchar2(60),
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table appliance_transport add constraint pk_appliance_transport primary key (row_id) using index;
create unique index uidx_appliance_transport on appliance_transport (rdc_id,appliance_transport_id);
comment on table appliance_transport is '家电派工';
comment on column appliance_transport.row_id is 'uuid主键';
comment on column appliance_transport.rdc_id is '物流中心';
comment on column appliance_transport.appliance_transport_id is '家电派工单号';
comment on column appliance_transport.plan_delivery_date is '计划发运时间';
comment on column appliance_transport.plan_arrive_date is '计划到达时间';
comment on column appliance_transport.plan_return_date is '计划返回时间';
comment on column appliance_transport.actual_delivery_date is '实际发运时间';
comment on column appliance_transport.actual_arrive_date is '实际到达时间';
comment on column appliance_transport.actual_return_date is '实际返回时间';
comment on column appliance_transport.driver_id is '司机编码';
comment on column appliance_transport.driver_name is '司机姓名';
comment on column appliance_transport.vehicle_number is '车牌号';
comment on column appliance_transport.estimate_mileage is '预估公里数';
comment on column appliance_transport.start_mileage is '开始公里数';
comment on column appliance_transport.end_mileage is '结束公路数';
comment on column appliance_transport.fee is '费用';
comment on column appliance_transport.city_stop_count is '市区站点数';
comment on column appliance_transport.nearby_stop_count is '周边站点数';
comment on column appliance_transport.area_stop_count is '区域站点数';
comment on column appliance_transport.from_stop is '始发站点';
comment on column appliance_transport.dispatch_id is '调度人';
comment on column appliance_transport.dispatch_name is '调度人姓名';
comment on column appliance_transport.porter_id1 is '搬运工1';
comment on column appliance_transport.porter_name1 is '搬运工1姓名';
comment on column appliance_transport.porter_id2 is '搬运工2';
comment on column appliance_transport.porter_name2 is '搬运工2姓名';
comment on column appliance_transport.porter_id3 is '搬运工3';
comment on column appliance_transport.porter_name3 is '搬运工3姓名';
comment on column appliance_transport.recoverable is '是否报销';
comment on column appliance_transport.recoverable_status is '报销状态';
comment on column appliance_transport.print_count is '打印次数';
comment on column appliance_transport.status is '状态';
comment on column appliance_transport.notes is '备注';
comment on column appliance_transport.add_id is '记录人';
comment on column appliance_transport.add_name is '记录人姓名';
comment on column appliance_transport.add_date is '记录时间';
comment on column appliance_transport.edit_id is '编辑人';
comment on column appliance_transport.edit_name is '编辑人姓名';
comment on column appliance_transport.edit_date is '编辑时间';

create table appliance_transport_detail
(
    row_id                      varchar2(32) not null,
    rdc_id                      varchar2(30) not null,
    appliance_transport_id      varchar2(30) not null,
    order_id 					varchar2(30) not null,
    order_type 					nvarchar2(30) not null,
    sku							varchar2(60) not null,
	sku_descr  					nvarchar2(60) not null,
    qty							number(22,5) default 0 not null,
    customer_id 				varchar2(30) not null,
    phone						varchar2(20),
    address						nvarchar2(100),
    estimate_mileage            number(22,5),
    start_mileage               number(22,5),
    end_mileage                 number(22,5),
    plan_delivery_date          date,
    plan_arrive_date            date,
    plan_return_date            date,
    actual_delivery_date        date,
    actual_arrive_date          date,
    actual_return_date          date,
    fee                         number(22,5),
    highway   					nvarchar2(1) default '否' not null,
   	exists_diff					nvarchar2(1) default '否' not null,
   	diff_notes 					nvarchar2(60),
    status                      varchar2(10) not null,
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table appliance_transport_detail add constraint pk_appliance_transport_detail primary key (row_id) using index;
create index idx_appliance_transport_detail on appliance_transport_detail (rdc_id,appliance_transport_id,order_id);
comment on table appliance_transport_detail is '家电派工明细';
comment on column appliance_transport_detail.row_id is 'uuid主键';
comment on column appliance_transport_detail.rdc_id is '物流中心';
comment on column appliance_transport_detail.appliance_transport_id is '家电派工单号';
comment on column appliance_transport_detail.order_id is '请送单号';
comment on column appliance_transport_detail.order_type is '单据类型';
comment on column appliance_transport_detail.sku  is '货品';
comment on column appliance_transport_detail.sku_descr  is '货品描述';
comment on column appliance_transport_detail.qty is '数量';
comment on column appliance_transport_detail.customer_id is '客户';
comment on column appliance_transport_detail.phone is '电话';
comment on column appliance_transport_detail.address is '地址';
comment on column appliance_transport_detail.estimate_mileage is '预估公里数';
comment on column appliance_transport_detail.start_mileage is '开始公里数';
comment on column appliance_transport_detail.end_mileage is '结束公里数';
comment on column appliance_transport_detail.plan_delivery_date is '计划发运时间';
comment on column appliance_transport_detail.plan_arrive_date is '计划到达时间';
comment on column appliance_transport_detail.plan_return_date is '计划返回时间';
comment on column appliance_transport_detail.actual_delivery_date is '实际发运时间';
comment on column appliance_transport_detail.actual_arrive_date is '实际到达时间';
comment on column appliance_transport_detail.actual_return_date is '实际返回时间';
comment on column appliance_transport_detail.fee is '费用';
comment on column appliance_transport_detail.highway is '是否走高速';
comment on column appliance_transport_detail.exists_diff is '是否有差异';
comment on column appliance_transport_detail.diff_notes is '差异备注';
comment on column appliance_transport_detail.status is '状态';
comment on column appliance_transport_detail.add_id is '记录人';
comment on column appliance_transport_detail.add_name is '记录人姓名';
comment on column appliance_transport_detail.add_date is '记录时间';
comment on column appliance_transport_detail.edit_id is '编辑人';
comment on column appliance_transport_detail.edit_name is '编辑人姓名';
comment on column appliance_transport_detail.edit_date is '编辑时间';

create table vehicle
(
    row_id                      varchar2(32) not null,
    rdc_id                      varchar2(30) not null,
    vehicle_number				varchar2(20) not null,
    vehicle_type 				nvarchar2(30) not null,
    driver_id                   varchar2(20),
    driver_name                 nvarchar2(20),
    vehicle_length 				number(22,5) default 0 not null,
    vehicle_width				number(22,5) default 0 not null,
    vehicle_height				number(22,5) default 0 not null,
    engine_id 					varchar2(20),
    frame_id 					varchar2(20),
    carrying_capacity 			number(22,5) default 0 not null,
    self_weight 				number(22,5) default 0 not null,
    seat_count 					number default 0 not null,
    status                      varchar2(10) not null,
    notes                       nvarchar2(60),
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table vehicle add constraint pk_vehicle primary key (row_id) using index;
create unique index uidx_vehicle on vehicle (rdc_id,vehicle_number);
comment on table vehicle is '车辆';
comment on column vehicle.row_id is 'uuid主键';
comment on column vehicle.rdc_id is '物流中心';
comment on column vehicle.vehicle_number is '车牌号';
comment on column vehicle.vehicle_type is '车辆类型';
comment on column vehicle.driver_id is '司机';
comment on column vehicle.driver_name is '司机姓名';
comment on column vehicle.vehicle_length is '车辆长度';
comment on column vehicle.vehicle_width is '车辆宽度';
comment on column vehicle.vehicle_height is '车辆高度';
comment on column vehicle.engine_id is '发动机编号';
comment on column vehicle.frame_id is '车架编号';
comment on column vehicle.carrying_capacity is '载重';
comment on column vehicle.self_weight is '自重';   ;
comment on column vehicle.seat_count is '座位数量';
comment on column vehicle.status is '状态';
comment on column vehicle.notes is '备注';
comment on column vehicle.add_id is '记录人';
comment on column vehicle.add_name is '记录人姓名';
comment on column vehicle.add_date is '记录时间';
comment on column vehicle.edit_id is '编辑人';
comment on column vehicle.edit_name is '编辑人姓名';
comment on column vehicle.edit_date is '编辑时间';
				
create table driver
(
    row_id                      varchar2(32) not null,
    rdc_id                      varchar2(30) not null,
    driver_id                   varchar2(20) not null,
    driver_name                 nvarchar2(20) not null,
    card_id 					varchar2(18),
    sex 						nvarchar2(1) not null,
    born_date					date,
	work_date					date,
	degree						varchar2(30),
	address						nvarchar2(100),
	phone						varchar2(20),
    licence_id 					varchar2(20) not null,
    licence_type				varchar2(20) not null,
    status                      varchar2(10) not null,
    notes                       nvarchar2(60),
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table driver add constraint pk_driver primary key (row_id) using index;
create unique index uidx_driver on driver (rdc_id,driver_id);
comment on table driver is '司机';
comment on column driver.row_id is 'uuid主键';
comment on column driver.rdc_id is '物流中心';
comment on column driver.driver_id is '司机';
comment on column driver.driver_name is '司机姓名';
comment on column driver.card_id is '身份证';
comment on column driver.sex is '性别';
comment on column driver.born_date is '出生日期';
comment on column driver.work_date is '入职日期';
comment on column driver.degree is '学历';
comment on column driver.address is '地址';
comment on column driver.phone is '电话';
comment on column driver.licence_id is '驾驶证号';
comment on column driver.licence_type is '驾驶证类型';
comment on column driver.status is '状态';
comment on column driver.notes is '备注';
comment on column driver.add_id is '记录人';
comment on column driver.add_name is '记录人姓名';
comment on column driver.add_date is '记录时间';
comment on column driver.edit_id is '编辑人';
comment on column driver.edit_name is '编辑人姓名';
comment on column driver.edit_date is '编辑时间';

create table porter
(
    row_id                      varchar2(32) not null,
    rdc_id                      varchar2(30) not null,
    porter_id                   varchar2(20) not null,
    porter_name                 nvarchar2(20) not null,
    work_group 					nvarchar2(30) not null,
    sex 						nvarchar2(1) not null,
    born_date					date,
    work_date					date,
    address						nvarchar2(100),
	phone						varchar2(20),
    status                      varchar2(10) not null,
    notes                       nvarchar2(60),
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table porter add constraint pk_porter primary key (row_id) using index;
create unique index uidx_porter on porter (rdc_id,porter_id);
comment on table porter is '搬运工';
comment on column porter.row_id is 'uuid主键';
comment on column porter.rdc_id is '物流中心';
comment on column porter.porter_id is '搬运工';
comment on column porter.porter_name is '搬运工姓名';
comment on column porter.work_group is '工作组';
comment on column porter.sex is '性别';
comment on column porter.born_date is '出生日期';
comment on column porter.work_date is '入职日期';
comment on column porter.address is '地址';
comment on column porter.phone is '电话';
comment on column porter.status is '状态';
comment on column porter.notes is '备注';
comment on column porter.add_id is '记录人';
comment on column porter.add_name is '记录人姓名';
comment on column porter.add_date is '记录时间';
comment on column porter.edit_id is '编辑人';
comment on column porter.edit_name is '编辑人姓名';
comment on column porter.edit_date is '编辑时间';

create table rdc_branch
(
    row_id                      varchar2(32) not null,
    rdc_id						varchar2(30) not null,
    branch_id 					varchar2(30) not null,
	descr						nvarchar2(60) not null,
	phone						varchar2(20),
	fax							varchar2(20),
  	address						nvarchar2(100),
  	leader_id					varchar2(20),
  	leader_name 				nvarchar2(20),
  	status                      varchar2(10) not null,
  	notes                       nvarchar2(60),
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table rdc_branch add constraint pk_rdc_branch primary key (row_id) using index;
create unique index uidx_rdc_branch on rdc_branch (rdc_id,branch_id);
comment on table rdc_branch is '仓储部';
comment on column rdc_branch.row_id is 'uuid主键';
comment on column rdc_branch.rdc_id is '物流中心';
comment on column rdc_branch.branch_id is '仓储部编码';
comment on column rdc_branch.descr is '仓储部描述';
comment on column rdc_branch.phone is '电话';
comment on column rdc_branch.fax is '传真';
comment on column rdc_branch.address is '地址';
comment on column rdc_branch.leader_id is '仓储部负责人';
comment on column rdc_branch.leader_name is '负责人姓名';
comment on column rdc_branch.status is '状态:正常/废弃';
comment on column rdc_branch.notes is '备注';
comment on column rdc_branch.add_id is '记录人';
comment on column rdc_branch.add_name is '记录人姓名';
comment on column rdc_branch.add_date is '记录时间';
comment on column rdc_branch.edit_id is '编辑人';
comment on column rdc_branch.edit_name is '编辑人姓名';
comment on column rdc_branch.edit_date is '编辑时间';

create table rdc_team
(
    row_id                      varchar2(32) not null,
    rdc_id						varchar2(30) not null,
    branch_id 					varchar2(30) not null,
    team_id 					varchar2(30) not null,
	descr						nvarchar2(60) not null,
  	leader_id					varchar2(20),
  	leader_name 				nvarchar2(20),
  	status                      varchar2(10) not null,
  	notes                       nvarchar2(60),
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table rdc_team add constraint pk_rdc_team primary key (row_id) using index;
create unique index uidx_rdc_team on rdc_team (rdc_id,team_id);
comment on table rdc_team is '班组';
comment on column rdc_team.row_id is 'uuid主键';
comment on column rdc_team.rdc_id is '物流中心';
comment on column rdc_team.branch_id is '仓储部编码';
comment on column rdc_team.team_id is '班组编码';
comment on column rdc_team.descr is '班组描述';
comment on column rdc_team.leader_id is '班组负责人';
comment on column rdc_team.leader_name is '负责人姓名';
comment on column rdc_team.status is '状态:正常/废弃';
comment on column rdc_team.notes is '备注';
comment on column rdc_team.add_id is '记录人';
comment on column rdc_team.add_name is '记录人姓名';
comment on column rdc_team.add_date is '记录时间';
comment on column rdc_team.edit_id is '编辑人';
comment on column rdc_team.edit_name is '编辑人姓名';
comment on column rdc_team.edit_date is '编辑时间';

create table customer_difference
(
    row_id                      varchar2(32) not null,
    rdc_id						varchar2(30) not null,
    order_id 					varchar2(30) not null,
	extern_order_id				varchar2(30) not null,
	customer_id 				varchar2(30) not null,
	duty_name 					nvarchar2(20),
	owner_id 					varchar2(30) not null,
	sku							varchar2(60) not null,
	sku_descr					nvarchar2(60) not null,
	uom 						varchar2(30) not null,
	qty_shipped					number(22,5) not null,
	qty_difference 				number(22,5) not null,
	shipped_date 				date,
	receiver_name 				nvarchar2(20),
	received_date 				date,
	customer_notes              nvarchar2(400),
	difference_reason           nvarchar2(400),
	vehicle_number				varchar2(20) not null,
	driver_id                   varchar2(20) not null,
    driver_name                 nvarchar2(20) not null,
    locked  					nvarchar2(1) default '是' not null,
	with_guard					nvarchar2(1) default '是' not null,
	car_seal 					varchar2(30),
	branch_id 					varchar2(30) not null,
	rdc_notes             		nvarchar2(400),
	deal_reason					nvarchar2(100),
	deal_result					nvarchar2(100),
	modify_id                   varchar2(20),
    modify_name                 nvarchar2(20),
    modify_date                 date, 
  	status                      varchar2(10) not null,
    add_id                      varchar2(20),
    add_name                    nvarchar2(20),
    add_date                    date default sysdate,
    edit_id                     varchar2(20),
    edit_name                   nvarchar2(20),
    edit_date                   date
);
alter table customer_difference add constraint pk_customer_difference primary key (row_id) using index;
create unique index uidx_customer_difference on customer_difference (rdc_id,order_id,owner_id,sku);
comment on table customer_difference is '客户收货差异';
comment on column customer_difference.row_id is 'uuid主键';
comment on column customer_difference.rdc_id is '物流中心';
comment on column customer_difference.order_id is '订单号';
comment on column customer_difference.extern_order_id is '外部单号';
comment on column customer_difference.customer_id is '客户编码';
comment on column customer_difference.duty_name is '值班人';
comment on column customer_difference.owner_id is '货主';
comment on column customer_difference.sku is '货品';
comment on column customer_difference.sku_descr is '货品描述';
comment on column customer_difference.uom is '单位';
comment on column customer_difference.qty_shipped is '发运数量';
comment on column customer_difference.qty_difference is '差异数量';
comment on column customer_difference.shipped_date is '发运日期';
comment on column customer_difference.receiver_name is '收货人';
comment on column customer_difference.received_date is '收货日期'; 
comment on column customer_difference.customer_notes is '客户备注';
comment on column customer_difference.difference_reason is '差异原因';
comment on column customer_difference.vehicle_number is '车牌号';
comment on column customer_difference.driver_id is '司机';
comment on column customer_difference.driver_name is '司机姓名';
comment on column customer_difference.locked is '是否锁车';
comment on column customer_difference.with_guard is '是否有押车';
comment on column customer_difference.car_seal is '铅封号';
comment on column customer_difference.branch_id is '物流部';
comment on column customer_difference.rdc_notes is '物流备注';
comment on column customer_difference.deal_reason is '处理原因';
comment on column customer_difference.deal_result is '处理结果';
comment on column customer_difference.modify_id is '客户修改人';
comment on column customer_difference.modify_name is '修改人姓名';
comment on column customer_difference.modify_date is '客户修改时间';          
comment on column customer_difference.status is '状态:待确认/已确认';
comment on column customer_difference.add_id is '记录人';
comment on column customer_difference.add_name is '记录人姓名';
comment on column customer_difference.add_date is '记录时间';
comment on column customer_difference.edit_id is '物流确认人';
comment on column customer_difference.edit_name is '确认人姓名';
comment on column customer_difference.edit_date is '确认时间';

create table return_strategy
(
	row_id						varchar2(32) not null,
	rdc_id 						varchar2(30) not null,
	return_strategy_id			varchar2(30) not null,
	descr 						nvarchar2(60) not null,
	owner_id					varchar2(30) not null,
	sku							varchar2(60) not null,
	sku_descr  					nvarchar2(60) not null,
	brand_id					varchar2(30) not null,
	brand_descr					nvarchar2(60) not null,
	return_defect				nvarchar2(1) default '否' not null,
	return_approach				nvarchar2(1) default '否' not null,
	notes                       nvarchar2(60),
	udf1         				varchar2(50),
    udf2         				varchar2(50),
    udf3         				varchar2(50),
  	add_id						varchar2(20),
	add_name					nvarchar2(20),
	add_date					date default sysdate,
	edit_id 					varchar2(20),
	edit_name					nvarchar2(20),
	edit_date					date
);
alter table return_strategy add constraint pk_return_strategy primary key (row_id) using index;
create unique index uidx_return_strategy on return_strategy (rdc_id,return_strategy_id);
comment on table return_strategy is '退货规则';
comment on column return_strategy.row_id is 'uuid主键';
comment on column return_strategy.rdc_id is '物流中心';
comment on column return_strategy.return_strategy_id is '退货规则编码';
comment on column return_strategy.descr is '规则描述';
comment on column return_strategy.owner_id is '货主';
comment on column return_strategy.sku is '货品';
comment on column return_strategy.sku_descr is '货品描述';
comment on column return_strategy.brand_id is '品牌';
comment on column return_strategy.brand_descr is '品牌描述';
comment on column return_strategy.return_defect is '是否退残次';
comment on column return_strategy.return_approach is '是否退临期';
comment on column return_strategy.notes is '备注';
comment on column return_strategy.udf1 is '用户自定义1';
comment on column return_strategy.udf2 is '用户自定义2';
comment on column return_strategy.udf3 is '用户自定义3';
comment on column return_strategy.add_id is '记录人';
comment on column return_strategy.add_name is '记录人姓名';
comment on column return_strategy.add_date is '记录时间';
comment on column return_strategy.edit_id is '编辑人';
comment on column return_strategy.edit_name is '编辑人姓名';
comment on column return_strategy.edit_date is '编辑时间';

create table customer_users
(
 row_id							varchar2(32) not null,
 customer_id       				varchar2(30) not null,
 customer_descr            	  	nvarchar2(60) not null,
 user_id      					varchar2(30) not null,
 user_name     					nvarchar2(20) not null,
 add_id      					varchar2(20),
 add_name     					nvarchar2(20),
 add_date     					date default sysdate
);
alter table customer_users add constraint pk_customer_users primary key (row_id) using index;
create unique index uidx_customer_users on customer_users (customer_id,user_id);
comment on table customer_users is '客户与用户对应表';
comment on column customer_users.row_id is 'uuid主键';
comment on column customer_users.customer_id is '客户';
comment on column customer_users.customer_descr is '客户描述';
comment on column customer_users.user_id is '用户编码';
comment on column customer_users.user_name is '用户姓名';
comment on column customer_users.add_id is '记录人';
comment on column customer_users.add_name is '记录人姓名';
comment on column customer_users.add_date is '记录时间';